case structure in vb.net!!! [modified]
-
in my project, i use toolbar toolbar in my buttons...i used case structure for the functions of each buttons in the toolbar but theres an error in it... my codes goes like this:
Select Case Case 0 Dim subjects As New subjects subjects.Show() Me.Hide() Case 1 Dim file_maintenance As New file_maintenance file_maintenance.Show() Me.Hide() Case 2 Dim grade_entry As New grade_entry grade_entry.Show() Me.Hide() End Select
is this code correct??? or this:dim keyin as integer Select Case keyIn Case 0 Dim subjects As New subjects subjects.Show() Me.Hide() Case 1 Dim file_maintenance As New file_maintenance file_maintenance.Show() Me.Hide() Case 2 Dim grade_entry As New grade_entry grade_entry.Show() Me.Hide() End Select
in the first code, there is an error so i can't run my program... in the other code, the 1st button is only functioning... what is the really correct code for this??? -
in my project, i use toolbar toolbar in my buttons...i used case structure for the functions of each buttons in the toolbar but theres an error in it... my codes goes like this:
Select Case Case 0 Dim subjects As New subjects subjects.Show() Me.Hide() Case 1 Dim file_maintenance As New file_maintenance file_maintenance.Show() Me.Hide() Case 2 Dim grade_entry As New grade_entry grade_entry.Show() Me.Hide() End Select
is this code correct??? or this:dim keyin as integer Select Case keyIn Case 0 Dim subjects As New subjects subjects.Show() Me.Hide() Case 1 Dim file_maintenance As New file_maintenance file_maintenance.Show() Me.Hide() Case 2 Dim grade_entry As New grade_entry grade_entry.Show() Me.Hide() End Select
in the first code, there is an error so i can't run my program... in the other code, the 1st button is only functioning... what is the really correct code for this???Second one is correct.
Rharzkie wrote:
in the other code, the 1st button is only functioning..
It depend on what this variable got.
dim keyin as integer
My example ~Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked Select Case e.ClickedItem.Text Case "&New" : MessageBox.Show("this is New") Case "&Open" : MessageBox.Show("this is New") End Select End Sub
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
Second one is correct.
Rharzkie wrote:
in the other code, the 1st button is only functioning..
It depend on what this variable got.
dim keyin as integer
My example ~Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked Select Case e.ClickedItem.Text Case "&New" : MessageBox.Show("this is New") Case "&Open" : MessageBox.Show("this is New") End Select End Sub
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
Second one is correct.
Rharzkie wrote:
in the other code, the 1st button is only functioning..
It depend on what this variable got.
dim keyin as integer
My example ~Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked Select Case e.ClickedItem.Text Case "&New" : MessageBox.Show("this is New") Case "&Open" : MessageBox.Show("this is New") End Select End Sub
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
in your example, the
case "&New"
andcase "&Open"
stands for what??? is it integer or string??? where did you get it???Friend WithEvents NewToolStripButton As System.Windows.Forms.ToolStripButton Friend WithEvents OpenToolStripButton As System.Windows.Forms.ToolStripButton Me.NewToolStripButton.Text = "&New" Me.OpenToolStripButton.Text = "&Open" Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NewToolStripButton, Me.OpenToolStripButton)
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
but in the second code i made, the first button is only funtioning... i will try your example...
Rharzkie wrote:
but in the second code i made, the first button is only funtioning...
What did you set to "
keyIn
" variable??Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
Rharzkie wrote:
but in the second code i made, the first button is only funtioning...
What did you set to "
keyIn
" variable??Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
keyin as integer...thats all... but i already try your example, and it works, thanks for that...
Rharzkie wrote:
but i already try your example, and it works, thanks for that..
Your welcome. my friend. If it is useful for you, don't forget to vote the message. Thank you too. :)
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)