how to code toolbar panels.
-
Dear friends, i wanted to know that how can i write code behind toolbar panels.. when eevr i double click on toolbar it takes me to buttonclick event of toolbar.. but how can i code behind the buttons i placed upon toolbar?
-
Dear friends, i wanted to know that how can i write code behind toolbar panels.. when eevr i double click on toolbar it takes me to buttonclick event of toolbar.. but how can i code behind the buttons i placed upon toolbar?
When you click on a toolbar, the toolbar's ButtonClick event is fired and the button that was click is passed in ToolBarButtonClickEventArgs - its button property contains the index of the button (from the Buttons collection). You could deal with it using a: Select Case yourToolBarName.Buttons.IndexOf (e.Button) for example.
-
When you click on a toolbar, the toolbar's ButtonClick event is fired and the button that was click is passed in ToolBarButtonClickEventArgs - its button property contains the index of the button (from the Buttons collection). You could deal with it using a: Select Case yourToolBarName.Buttons.IndexOf (e.Button) for example.
thank you sir with this help.. but do i always need to use Select Case for dealing with Buttons of ToolBar.. can you please send me a lil code snipper for this.. thank you
-
thank you sir with this help.. but do i always need to use Select Case for dealing with Buttons of ToolBar.. can you please send me a lil code snipper for this.. thank you
No, you could use If...End If. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmSelectCase.asp I've assumed an Open button, a Save button and a SaveAs button. For the Open button, I've pointed it at what might be the routine you've already written to handle a traditional menu item called mnuFileOpen. Select Case toolbar.Buttons.IndexOf(e.button) Case 0 mnuFileOpen_Click(Nothing, Nothing) Case 1 SaveFile() Case 2 SaveFileAs() Case Else ' Other values. 'Since you should know how many buttons you've got, you shouldn't 'need a Case Else. End Select Don't forget that if you've used separators, they'll be on this list. E.g. If you have a separator after the Open button, you should code: Case 1 Case 2 SaveFile() etc.