Reputation: 2986
I have this form
And I have this code
'For Tab Schedule
Dim Schedule_Tab = frmSettings.Tab_Schedule.Controls 'the tab page for schedule
Dim Panel_Set_Num As String
Dim Set_Num As String = "00"
Public Function Schedule_Get() As String
For Each Ctrl_Panel_Set As Control In Schedule_Tab
If TypeOf Ctrl_Panel_Set Is Panel And Ctrl_Panel_Set.Name.StartsWith("Panel_Set_") Then
For Each Ctrl_Lbl_Temp In Ctrl_Panel_Set.Controls
If TypeOf Ctrl_Lbl_Temp Is Label Then
If Ctrl_Lbl_Temp.Name.StartsWith("Lbl_Temp_") Then
If Ctrl_Lbl_Temp.Text = "0" Then
Panel_Set_Num = CType(Ctrl_Panel_Set, Panel).Name
Set_Num = "CSR" & Panel_Set_Num.Substring(Panel_Set_Num.Length - 2) & "^"
Return Set_Num
End If
End If
End If
Next
End If
Next Ctrl_Panel_Set
Return "Done"
End Function
And I have this error
1. Variable declaration without an 'As' clause; type of Object assumed.
2. Warning treated as error : Variable declaration without an 'As' clause; type of Object assumed.
The emphasize
of the error is in this line of code.
Dim Schedule_Tab = frmSettings.Tab_Schedule.Controls 'the tab page for schedule
I tried to follow what the error says so I changed
Dim Schedule_Tab
to Dim Schedule_Tab As Form.ControlCollection
but it result in this kind of error An unhandled exception of type System.TypeInitializationException' occurred in xxxxxxxxx.exe
.
Questions:
Schedule_Tab
?Upvotes: 0
Views: 1778
Reputation: 39142
It should be declared like this:
Dim Schedule_Tab As Control.ControlCollection = frmSettings.Tab_Schedule.Controls
Upvotes: 1