VB数组控件,列表框问题

来源:百度知道 编辑:UC知道 时间:2024/06/28 11:08:15
定义3个文本框,分别输入字符,单击按钮后在列表框中并列显示出来.
写错了,并排显示

,并排显示 这个用ListView 比较好吧?
ListView====================================
Private Sub Command1_Click()
Dim i As Integer
With Me.ListView1

Dim oListItem As ListItem

Set oListItem = .ListItems.Add(, , Me.Text1(0).Text)

For i = 1 To Me.Text1.Count - 1
oListItem.SubItems(i) = Me.Text1(i).Text
Next i
End With
End Sub

Private Sub Form_Load()
Dim i As Integer
With Me.ListView1
.View = lvwReport
For i = 0 To Me.Text1.Count - 1
.ColumnHeaders.Add , , "xx" & i
Next i
End With
End Sub

ListBox=====================================

Option Explicit

Private Sub Command1_Click()
Dim i As Integer
dim s as string
Me.List1.Clear
For i = 0 To Me.Text1.Count - 1
s = s & Me.Text1(i).Text & " "
Next i
Me.List1.AddItem s
End Sub

Pri