프로그래밍
[vb.net] Controlbox loop textbox add
프로세스 천국
2013. 3. 18. 07:23
텍스트박스가 아니면 컨트롤 박스이름으로 바꾸면 된다.
루프로 텍스트박스 5개 추가, 위치는 대충 맞추고..
폼로드
Dim cnt As Integer = 5
Dim i As Integer
Dim x As Integer = 12
For i = 1 To cnt
Dim myTextBox As New TextBox
myTextBox.Name = "autobox" & i
myTextBox.Location = New Point(x, 68)
myTextBox.Width = 290
Me.Controls.Add(myTextBox)
x = x + 300
Next
이벤트
Dim t1 As TextBox = CType(Me.Controls("autobox1"), TextBox)
t1.Text = dgv2.Rows(dgv2.CurrentCell.RowIndex).Cells(1).Value
Dim t2 As TextBox = CType(Me.Controls("autobox2"), TextBox)
t2.Text = dgv2.Rows(dgv2.CurrentCell.RowIndex).Cells(0).Value
.
.
.