case structure...
-
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???in the first case statement:
Rharzkie wrote:
Select Case
This should be
Select Case myVariable
where myVariable is the variable you are referencing to. The second one seems fine, there must be an issue in the way the keyIn is changed, it must not be being changed when the other buttons are pressed.Please check out my articles: The ANZAC's articles
-
in the first case statement:
Rharzkie wrote:
Select Case
This should be
Select Case myVariable
where myVariable is the variable you are referencing to. The second one seems fine, there must be an issue in the way the keyIn is changed, it must not be being changed when the other buttons are pressed.Please check out my articles: The ANZAC's articles
-
but when i used the 2nd codes, the first button is only functioning...in the other button, the function also same as the ist button (it should not be the same)...in short, case 1 in only functioning but the others did not...what's wrong with that???
like The ANZAC said the second case looks to be correct the problem may lay in how you change you're variable keyin perhaps debugging the project and looking at when the keyin variable is changed or not changed will help you further from the behavior you described my guess would be that the keyin variable isn't changed therfor the same code is excecuted for all buttons
-
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???