prince_XY143
February 17th, 2010, 11:17 PM
Hello everybody..... i'm having the following code to add the textboxes dynamically.... now i want to get the values entered in that textboxes dynamically..... PLS HEPL ME OUT....
heres the code:
Public Class Form1
Public x = 17
Public y = 60
Public Num As Integer
Public sNum As String
Private Sub frmDynamic_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sNum = InputBox("No of File to be uploaded...?", "FTP-Up Load", "", )
Me.ForeColor = Color.Black
Me.BackColor = Color.AliceBlue
If Integer.TryParse(sNum, Num) Then
addTxtToMe(Num)
Button1_mousemove()
Else
MessageBox.Show("App Quits!!! You did not enter a valid number")
End
End If
End Sub
Public Sub addTxtToMe(ByVal Num As Integer)
For counter As Integer = 1 To Num
Dim txt As New TextBox()
txt.Name = "txtDynamic" & counter
txt.Location = New Point(x, y)
txt.Size = New Size(190, 25)
Me.Controls.Add(txt)
y = y + 25
If y > 555 Then
x = x + 210
y = 5
End If
Next
End Sub
Private Sub Button1_mousemove()
Button1.Name = "butDynamic"
Button1.Text = "Submit"
Button1.Location = New Point(x, y)
Button1.Parent = Me
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'For counter As Integer = 1 To Num
' Dim i = 1
' If Not txt.Text Is Nothing Then
' Do
' End
' Loop
' End If
'Next
End Sub
End Class
Pls figure out the mistakes n corrections.....
THANKS IN ADVANCE...........
heres the code:
Public Class Form1
Public x = 17
Public y = 60
Public Num As Integer
Public sNum As String
Private Sub frmDynamic_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sNum = InputBox("No of File to be uploaded...?", "FTP-Up Load", "", )
Me.ForeColor = Color.Black
Me.BackColor = Color.AliceBlue
If Integer.TryParse(sNum, Num) Then
addTxtToMe(Num)
Button1_mousemove()
Else
MessageBox.Show("App Quits!!! You did not enter a valid number")
End
End If
End Sub
Public Sub addTxtToMe(ByVal Num As Integer)
For counter As Integer = 1 To Num
Dim txt As New TextBox()
txt.Name = "txtDynamic" & counter
txt.Location = New Point(x, y)
txt.Size = New Size(190, 25)
Me.Controls.Add(txt)
y = y + 25
If y > 555 Then
x = x + 210
y = 5
End If
Next
End Sub
Private Sub Button1_mousemove()
Button1.Name = "butDynamic"
Button1.Text = "Submit"
Button1.Location = New Point(x, y)
Button1.Parent = Me
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'For counter As Integer = 1 To Num
' Dim i = 1
' If Not txt.Text Is Nothing Then
' Do
' End
' Loop
' End If
'Next
End Sub
End Class
Pls figure out the mistakes n corrections.....
THANKS IN ADVANCE...........