-
here is my code how do i add data to these columnsplease help me!!
Code:
Private Sub Form_Load()
'creat obj var for columnHeader obj and listitem obj
Dim sColumn As ColumnHeader
Dim sitem As ListItem
'start in report view
listview1.View = lvwReport
'set the size and pos of the listview
listview1.Width = ScaleWidth
listview1.Height = ScaleHeight
listview1.Top = ScaleTop
listview1.Left = ScaleLeft
'add columnHeaders..the width of the columns is
'the widht of the ctrl / 2 by the num of headers
Set sColumn = listview1.ColumnHeaders.Add(, , "Name")
Set sColumn = listview1.ColumnHeaders.Add(, , "Phone #1")
Set sColumn = listview1.ColumnHeaders.Add(, , "Phone #2")
End Sub
-
Try this,
Code:
Private Sub Form_Load()
'creat obj var for columnHeader obj and listitem obj
Dim sColumn As ColumnHeader
Dim sitem As ListItem
'start in report view
ListView1.View = lvwReport
'set the size and pos of the listview
ListView1.Width = ScaleWidth
ListView1.Height = ScaleHeight
ListView1.Top = ScaleTop
ListView1.Left = ScaleLeft
'add columnHeaders..the width of the columns is
'the widht of the ctrl / 2 by the num of headers
Set sColumn = ListView1.ColumnHeaders.Add(, , "Name")
Set sColumn = ListView1.ColumnHeaders.Add(, , "Phone #1")
Set sColumn = ListView1.ColumnHeaders.Add(, , "Phone #2")
For i = 1 To 10
ListView1.ListItems.Add , , i
ListView1.ListItems(i).SubItems(1) = Format(Str(Int(Rnd * 100000000)), "0-###-###-####")
ListView1.ListItems(i).SubItems(2) = Format(Str(Int(Rnd * 100000000)), "0-###-###-####")
Next i
End Sub
-
thanks alot that worked
but if i want to edit that data displayed how would i do that????
-
Here is how u can edit the Data at Runtime. Or You can click on the item twice(not Double Click) to edit it.
Code:
Private Sub Command1_Click()
ListView1.SelectedItem.Text = "New Name"
ListView1.SelectedItem.ListSubItems(1) = "New Phone No1"
ListView1.SelectedItem.ListSubItems(2) = "New Phone No2"
End Sub