PDA

Click to See Complete Forum and Search --> : Using the ToolBar . . . giving the buttons some code. .. how do u do it?


struntz
Nov 20th, 1999, 12:22 AM
hey marty . .. i used this

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case LCase(Button.Key)
Case "Open"
mnuOpen_Click
Case "Save"
mnuSave_Click
End Select
end sub

and it still doesn't do anything what am i doing wrong?
the mnuOpen and the mnuSave work when u go to file and then click them but wjhen i put them on toolbar they do nothing when i click the toolbar icon . .. did i select Case somthign wrong? like is it suppose to be set at Select Case LCase(button.key)?


------------------
Cory Sanchez
Young Student
ICQ#: 18640149

MartinLiss
Nov 20th, 1999, 12:30 AM
Replace the Select Case LCase(Button.Key) with Select Case Button.Key. You use "Open", for example, in your Select Case statement, so just make sure that the value of the Key in the button's properties is "Open", so that it matches exactly.

------------------
Marty

struntz
Nov 20th, 1999, 12:32 AM
oh i c now! thanks again!

------------------
Cory Sanchez
Young Student
ICQ#: 18640149

MartinLiss
Nov 20th, 1999, 12:41 AM
No you don't "c" now, you VB now ;)

------------------
Marty

struntz
Nov 20th, 1999, 11:47 AM
Hello i am making a simple word processor but i want to make it so the user cna use the toolbar . .. i use an image list and i know how to load the images into the toolbar but i don't know how to make the toolbar respond to the click event . . . how do i make it so i can give the toolbar buttons code to do the same as the mnuFile and so on does? i hope i explained it enough.

Thanks for your time.


------------------
Cory Sanchez
Young Student
ICQ#: 18640149

MartinLiss
Nov 20th, 1999, 11:59 AM
Here's how:
Private Sub tbarButtons_ButtonClick(ByVal Button As ComctlLib.Button)

Select Case LCase(Button.Key)
Case "new"
mnuNewSystem_Click
Case "open"
mnuOpen_Click
Case "save"
mnuSave_Click
Case "print"
mnuPrint_Click
End Select

End Sub

The items like "save" and "print" are the "Key" property of the various buttons.

------------------
Marty