phuongthu0109
Thành viên mới
- Tham gia
- 3/6/15
- Bài viết
- 22
- Được thích
- 1
Mình cần load dữ liệu lên userform và chỉnh sửa trực tiếp trên này.
Mình sử dụng listview nhưng cái này chỉ chỉnh sửa được cột dữ liệu đầu tiên.
Ai có giải pháp gì không ạ.
-------------------
class
userform
Mình sử dụng listview nhưng cái này chỉ chỉnh sửa được cột dữ liệu đầu tiên.
Ai có giải pháp gì không ạ.
-------------------
class
Mã:
Private WithEvents txtboxh As MsForms.TextBox
'Method
Public Sub Add(Form As MsForms.UserForm, ByVal na_me As String)
Set txtboxh = Form.Controls.Add("Forms.TextBox.1")
txtboxh.Name = na_me
End Sub
'Property
'Top
Public Property Let Top(ByVal tp As Integer)
txtboxh.Top = tp
End Property
Public Property Get Top() As Integer
Top = txtboxh.Top
End Property
'Height
Public Property Let Height(ByVal ht As Integer)
txtboxh.Height = ht
End Property
Public Property Get Height() As Integer
Height = txtboxh.Height
End Property
'width
Public Property Let width(ByVal ht As Integer)
txtboxh.width = ht
End Property
Public Property Get width() As Integer
width = txtboxh.width
End Property
'left
Public Property Let left(ByVal ht As Integer)
txtboxh.left = ht
End Property
Public Property Get left() As Integer
left = txtboxh.left
End Property
'name
'event
Private Sub txtboxh_Change()
MsgBox txtboxh.Name
End Sub
userform
Mã:
Private txtbh() As Classtextboxh
Private Sub UserForm_Initialize()
Dim n As Integer
Dim cnt As Integer
n = 12
cnt = 0
For i = 1 To n Step 1
cnt = cnt + 1
ReDim Preserve txtbh(1 To cnt)
Set txtbh(cnt) = New Classtextboxh
With txtbh(cnt)
.Add Me, "mytextbox" & i
.Top = 10 + i * 15
.Height = 20
.width = 30
.left = 5
End With
Next i
End Sub
Lần chỉnh sửa cuối: