|
-
Oct 4th, 2006, 08:48 AM
#1
Thread Starter
Member
[02/03] Dynamic Controls
I have number of text boxes in a Windows form
textbox1,textbox2,textbox3 etc.
I want to retrieve the values from these textboxes dynamically
like => Dim txt as textbox
for i = 1 to 3
txt.name = "textbox" & i
msgbox txt.text
next
This is not working. Can you please help.
Thanks
-
Oct 4th, 2006, 08:59 AM
#2
Re: [02/03] Dynamic Controls
put the textboxes in an array
textboxes(0), textboxes(2), textboxes(2) .
Then use
VB Code:
For I = 0 To 2
MsgBox (textboxes(i).Text)
Next
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 4th, 2006, 09:15 AM
#3
Re: [02/03] Dynamic Controls
Or just loop through the controls and check if it is a Textbox
VB Code:
For Each cTemp As Control In Me.Controls
If TypeOf (cTemp) Is TextBox Then
MessageBox.Show(cTemp.Text)
End If
Next
Use [code] source code here[/code] tags when you post source code.
My Articles
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|