Dim Floor As String = (gettxtFloor.Text)
Dim i As Integer
For i = 1 To Floor
Dim txt As New TextBox()
Dim txtid As String = txt.ID
txt.ID = i
' txt.Text = "ID = " + txt.ID
phMain.Controls.Add(txt)
Next
Dim Floor As String = 2
Dim i As Integer
For i = 1 To Floor
Dim txt As New TextBox()
'Dim txtid As String = txt.ID
txt.Name = "ID = " + i.ToString()
txt.Text = "ID = " + i.ToString()
txt.Location = New Point(100 * i, 400)
MyBase.Controls.Add(txt)
Next
MessageBox.Show(MyBase.Controls("ID = 1").ToString())
Date :
2010-03-24 16:19:56
By :
numenoy
No. 2
Guest
มัน error ตรงที่ txt.Name อย่างงี้อ่ะค่ะ
'Name' is not a member of 'System.Web.UI.WebControls.TextBox'.
หนูลองเปลี่ยนจาก MessageBox.Show(MyBase.Controls("ID = 1").ToString())
เป็น MsgBox(MyBase.Controls("ID = 1").ToString())
ก็ขึ้น error แบบนี้ค่ะ
Conversion from string "ID = 1" to type 'Integer' is not valid.