I am using VB6.0. So, your information will not be related with my case directly. Normally, system should have a property to set how many columns we want to use.
But, I can't find it. So, I use default to update "DataGrid". Then, system will prompt error message like
Currently, I have 3 listboxs' data, but I don't know how to create 3 columns and show them with datagrid control.
Does anyone give me a guid line how to show listbox's data with datagrid?
You can fill recordset with listbox items then you can set datagrid source with current recordset.
see this example :
Private Sub Command1_Click()
Dim rsTest As New ADODB.Recordset
' create new column in recordset named listbox1, listbox2, listbox3
' every column has unique name
.Append "Listbox1", adBSTR
.Append "Listbox2", adBSTR
.Append "Listbox3", adBSTR
For i = 0 To List1.ListCount
' add every listbox items into each column
.Fields("Listbox1") = List1.List(i)
.Fields("Listbox2") = List2.List(i)
.Fields("Listbox3") = List3.List(i)
Set DataGrid1.DataSource = rsTest
Private Sub Form_Load()
For i = 1 To 10
For j = 11 To 20
For k = 21 To 30