Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Determine Enabled Status for Cut, Copy, Paste Toolbar Items

Posted on 2008-06-22
5
Medium Priority
?
230 Views
Last Modified: 2011-10-19
Hello,
I have a toolbar that contains a cut, copy, and paste button and I need them to enable/disable accordingly with my TextStandard textbox.  So for example, if my cursor is in the TextStandard textbox (nothing's selected) and I have text within my clipboard, the cut and copy buttons should become disabled and the paste button should be enabled.  Now if i select atleast a character of text, all 3 buttons should be enabled.  If I don't have anything within my clipboard, the Paste button should be disabled. How do i accomplish this? (exactly like MS word)
0
Comment
Question by:Gunit2507
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 6

Expert Comment

by:psychic_zero
ID: 21843700
What version of VB you are using?
0
 

Author Comment

by:Gunit2507
ID: 21851269
VB6
0
 
LVL 6

Accepted Solution

by:
psychic_zero earned 2000 total points
ID: 21853142
Pls create a VB project based on the instruction I gave you in Word document. Then copy and paste this code in the project. Hope this can help you...
Private Sub Command1_Click()
Clipboard.Clear
Toolbar1.Buttons(3).Enabled = False
End Sub
 
Private Sub Form_Load()
Toolbar1.Buttons(1).Enabled = False
Toolbar1.Buttons(2).Enabled = False
 
If Clipboard.GetText = "" Then
    Toolbar1.Buttons(3).Enabled = False
Else
    Toolbar1.Buttons(3).Enabled = True
End If
 
End Sub
 
Private Sub Text1_Click()
If Text1.SelLength > 0 Then
    Toolbar1.Buttons(1).Enabled = True
    Toolbar1.Buttons(2).Enabled = True
Else
    Toolbar1.Buttons(1).Enabled = False
    Toolbar1.Buttons(2).Enabled = False
End If
End Sub
 
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If Text1.SelLength > 0 Then
    Toolbar1.Buttons(1).Enabled = True
    Toolbar1.Buttons(2).Enabled = True
Else
    Toolbar1.Buttons(1).Enabled = False
    Toolbar1.Buttons(2).Enabled = False
End If
End Sub
 
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
   Select Case Button.Key
   Case Is = "Cut"
      Clipboard.SetText Text1.SelText
      Text1.SelText = ""
      Toolbar1.Buttons(3).Enabled = True
   Case Is = "Copy"
      Clipboard.SetText Text1.SelText
      Toolbar1.Buttons(3).Enabled = True
   Case Is = "Paste"
        Text1.SelText = Clipboard.GetText
   End Select
End Sub

Open in new window

form-instruction.doc
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question