|
-
Jun 27th, 2004, 10:57 PM
#1
Thread Starter
Lively Member
Create Textbox in run time problem
i have create a textbox in the run time the code like below:
TempCode_TextBox = New TextBox
TempCode_TextBox.Location = New System.Drawing.Point(136, 16)
TempCode_TextBox.Size = New System.Drawing.Size(100, 22)
TempCode_TextBox.ReadOnly = True
TempCode_TextBox.Name = "TempCode_TextBox" & TempX & ""
TempCode_TextBox.Text = Me.code_TextBox.Text
the TempX is for the looping number
example like TempCode_TextBox1,TempCode_TextBox2,TempCode_TextBox3
after i have create the 3 textbox how can i get all the value or data in the textbox that i create in the run time
can i use the for loop statement to get all the value ??
Last edited by ninjaX; Jun 27th, 2004 at 11:32 PM.
-
Jun 27th, 2004, 11:33 PM
#2
Fanatic Member
this?
VB Code:
Dim t(2) As TextBox
Sub wahehehe()
Dim i As Integer
Dim y As Integer = 20
For i = 0 To 2
t(i) = New TextBox()
t(i).Location = New Point(10, y)
t(i).ReadOnly = True
t(i).Name = "textbox" & i.ToString
t(i).Text = t(i).Name
Me.Controls.Add(t(i))
AddHandler t(i).KeyDown, AddressOf hahaha
y += 22
Next
End Sub
Sub hahaha(ByVal sender As Object, ByVal e As KeyEventArgs)
Dim c As TextBox = sender
MessageBox.Show(c.Text)
End Sub
-
Jun 28th, 2004, 12:13 AM
#3
Thread Starter
Lively Member
sorry
after i create the text box in the run time, if i press the button save than it will help me to get the textbox value, it is possible to do that ???
-
Jun 28th, 2004, 12:25 AM
#4
Fanatic Member
this?
VB Code:
Dim t(2) As TextBox
Sub wahehehe()
Dim i As Integer
Dim y As Integer = 20
For i = 0 To 2
t(i) = New TextBox()
t(i).Location = New Point(10, y)
t(i).ReadOnly = True
t(i).Name = "textbox" & i.ToString
t(i).Text = t(i).Name
Me.Controls.Add(t(i))
y += 22
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim s As String
For i = 0 To UBound(t)
s += t(i).Text & Constants.vbCrLf
Next
MessageBox.Show(s)
End Sub
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
|