getting the declared variable from inside [Resolved]
halu,
i don't if the subject fits my needs here. i don't know what to put on the subject. hehehe... this is my problem...
VB Code:
Public Sub Add()
If TabPage1.Focus Then
Dim i As Integer
For i = 0 To Panel1.Controls.Count - 1
If TypeOf Panel1.Controls(i) Is TextBox Then
Dim t As TextBox = Panel1.Controls(i)
ElseIf TypeOf Panel1.Controls(i) Is ComboBox Then
Dim t As ComboBox = Panel1.Controls(i)
End If
'getting t here
Next
End If
End Sub
is it possible? if it is how? just asking cause my code here goes like this...
VB Code:
Public Sub Add()
If TabPage1.Focus Then
Dim i As Integer
For i = 0 To Panel1.Controls.Count - 1
If TypeOf Panel1.Controls(i) Is TextBox Then
Dim t As TextBox = Panel1.Controls(i)
'some conditions of t.text=string.empty
'do something
ElseIf TypeOf Panel1.Controls(i) Is ComboBox Then
Dim t As ComboBox = Panel1.Controls(i)
'some conditions of t.text=string.empty
'do something
End If
Next
End If
End Sub
it's kinda redundant on having some conditions of control.text=string.empty and doing something there. the same function is done...
this kinda sort for beginners... hehehe... any help is greatly appreciated. i'm a newbie though but a wanna be...
or...... any ideas more elegant than mine... :bigyello: