Jay1b Posted September 15, 2003 Posted September 15, 2003 I am trying to read the activation of toolbar button using a case statement. I can read them fine using if statements, but tht seems unefficient. The problem is, i keep getting a blue line under the is. Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick select e.Button is Case tbrOptions Case tbrConnect Case tbrPause Case tbrExit End Select End Sub Thanks. Quote
*Experts* mutant Posted September 15, 2003 *Experts* Posted September 15, 2003 You would have to do this: Select Case ToolBar1.Buttons.IndexOf(e.Button) This will return to you the index of the button, and you then choose what to do based on the index. Quote
*Experts* Volte Posted September 15, 2003 *Experts* Posted September 15, 2003 You can use an If..EndIf block in this way.If e.Button Is tbrOptions Then 'Blah ElseIf e.Button is tbrConnect Them 'Blah 'etc End IfNot much different than a Select Case statement. This way you can reorder them without messing up the indexes. Quote
Jay1b Posted September 15, 2003 Author Posted September 15, 2003 Yeah i used the elseif statements when i couldnt figure out the case statements. I made the post, so i could see where i was going wrong. Thanks again Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.