|
-
Jan 22nd, 2003, 09:58 PM
#1
Thread Starter
Lively Member
Tool Bar question..
Hey guys I am having difficulty with the toolbar.. I get my button in.. but were to a do my code for each individual button?
right now they all do the same.?? I am confused were to I specify what each one does thanks..
-
Jan 22nd, 2003, 10:10 PM
#2
Use the Toolbar's ButtonClick or the ButtonMenuClick (dropdown types ) events. These events get passed a reference to a Button or ButtonMenu object. Then do a Select Case on the Index or Key properties.
VB Code:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Insert"
'Call procedure to Insert a record
Case "Update"
'Call procedure to Update a record
Case "Delete"
'Call procedure to Delete a record
End Select
End Sub
-
Jan 22nd, 2003, 10:10 PM
#3
Frenzied Member
Use the ButtonClicked Event:
VB Code:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "New"
'...
End Select
End Sub
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Jan 22nd, 2003, 10:28 PM
#4
Thread Starter
Lively Member
hmm so for example..
So this is an example of my code.. soo it would be something like this.
Dim l As Long
l = MsgBox("Do you have this program installed?", vbYesNo)
If (l = 6) Then
Shell ("C:\Program Files\Vantive32\vantiv32.exe")
Else
End If
Select Case Button.Key
Case "Insert"
Dim l As Long
l = MsgBox("Do you have this program installed?", vbYesNo)
If (l = 6) Then
Shell ("C:\Program Files\Vantive32\vantiv32.exe")
Else
End If
Case "Update"
'Call procedure to Update a record
Case "Delete"
'Call procedure to Delete a record
-
Jan 22nd, 2003, 10:36 PM
#5
Well, if that's the code you want to run when the user clicks your button whose key is "Insert" then yes.
OT : Use constants whenever you can. It makes your code more readable. for example
VB Code:
If MsgBox("Do you have this program installed?", vbYesNo) = vbYes Then
Shell ("C:\Program Files\Vantive32\vantiv32.exe")
End if
-
Jan 22nd, 2003, 11:09 PM
#6
Thread Starter
Lively Member
hmmm
'
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key <=- what ??
Case Vantive
MsgBox ("test")
Case Helpdesk
MsgBox ("test2")
End Select
'
mm something like this?!
button key represents what?
-
Jan 23rd, 2003, 02:06 AM
#7
Button.Key is a string and is whatever you want it to be. On the Toolbar property page there is a button tab. Select the button and set the key.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|