Hi, i am having problem with my vb project to clear all item in my form. Below is the code that i am using :
Dim ctrl, obj as control
For Each ctrl in Me.controls
If typeof ctrl is GroupBox then
For Each obj In ctrl.Controls
If typeof obj is TextBox or typeof is ComboBox or typeof is ListBox then
obj.text =""
End if
Next
Elseif typeof ctrl is TextBox then
ctrl.text = ""
End if
Next
The error is :
InvalidCastException was unhandled
An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
Additional Information : Conversion from string "" to type 'Double' is not valid.
Please Enlighten me. I really do not understand it.