Creating a list in a grid control from a textbox list?

Hello all!

I have a problem.
How can I make a list in a grid control e.g.

from pure text in textbox:

"5316900043947001FFEC",1
"5316900043947001FFD7",1
"5316900043947001016D",0

to a list in any grid control that will look like:

------------
| KPSL ID | FLAGS |
------------
| "5316900043947001FFEC" | 1 |
| "5316900043947001FFD7" | 1 |
| "5316900043947001016D" | 0 |
------------

So how can i convert a regular, TextBox list to any grid control? Which grid control can you recommend me? :(

Please help. :(

Cheers!
NTxC
[672 byte] By [NTxC] at [2007-11-20 11:49:17]
# 1 Re: Creating a list in a grid control from a textbox list?
Search for FlexGrid as it's the easiest to customize, I think.
dglienna at 2007-11-9 19:32:15 >
# 2 Re: Creating a list in a grid control from a textbox list?
Is there a grid control for VB6 like this?

http://img126.imageshack.us/my.php?image=clipboard011ay0.jpg
NTxC at 2007-11-9 19:33:24 >
# 3 Re: Creating a list in a grid control from a textbox list?
First, it's in a TABSTRIP control, and then it looks like either a flexgrid or a listview (which is harder, imho)

Here's a flexgrid:
dglienna at 2007-11-9 19:34:23 >
# 4 Re: Creating a list in a grid control from a textbox list?
Ok i managed to do a good 'grid' with ListView.

But now I have the MAIN problem. ;)

How to convert plain textbox' text to an array and then convert it to the 'grid' i just created with ListView? I searched through Net and couldn't find anything. :(

e.g.

in textbox i have:
"5316900043947001FFEC",1,100
"5316900043947001016D",0,19

i want to make program convert it to:
ListView1.ListItems.Add(1).Text = "5316900043947001FFEC"
ListView1.ListItems.Item(1).ListSubItems.Add(1).Text = "1"
ListView1.ListItems.Item(1).ListSubItems.Add(2).Text = "100"
ListView1.ListItems.Add(2).Text = "5316900043947001016D"
ListView1.ListItems.Item(2).ListSubItems.Add(1).Text = "0"
ListView1.ListItems.Item(2).ListSubItems.Add(2).Text = "19"

at program runtime.

How can I let program know where the next values start in 1 line of text in TextBox?

Help me Guru's please :)

Cheers
NTxC
NTxC at 2007-11-9 19:35:23 >
# 5 Re: Creating a list in a grid control from a textbox list?
Chose the hard way, I guess. Have fun with the lv!
Ignore the coloring code.

Option Explicit

Private Sub Form_Load()
ListView1.FullRowSelect = True
ListView1.View = lvwReport
Dim itmX As ListItem ' Create a variable to add ListItem objects.
Dim clmX As ColumnHeader ' Create an object variable for the ColumnHeader object.
' Add ColumnHeaders.
Set clmX = ListView1.ColumnHeaders.Add(, , "Column 1", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders.Add(, , "Column 2", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders.Add(, , "Column 3", ListView1.Width / 3)

ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.
ListView1.View = lvwReport ' Set View property to Report.

' Add a main item
Set itmX = ListView1.ListItems.Add(, , "First value")
' Add two subitems for that item
itmX.SubItems(1) = "First value subitem 1"
itmX.SubItems(2) = "First value subitem 2"

' Add another main item
Set itmX = ListView1.ListItems.Add(, , "Second value")
' Add two subitems for that item
itmX.SubItems(1) = "Second value subitem 1"
itmX.SubItems(2) = "Second value subitem 2"

' Add another main item
Set itmX = ListView1.ListItems.Add(, , "Third value")
' Add two subitems for that item
itmX.SubItems(1) = "Third value subitem 1"
itmX.SubItems(2) = "Third value subitem 2"

ReDim Preserve clr(ListView1.ListItems.Count)
'Initialise the subclassing
g_MaxItems = ListView1.ListItems.Count - 1
g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub

Private Sub Form_Unload(Cancel As Integer)
SetWindowLong hWnd, GWL_WNDPROC, g_addProcOld
End Sub

Private Sub ListView1_Click()
If ListView1.SelectedItem.Index < 0 Then Exit Sub
SetLIBackColor ListView1, ListView1.SelectedItem.Index, vbRed
End Sub
dglienna at 2007-11-9 19:36:21 >
# 6 Re: Creating a list in a grid control from a textbox list?
Chose the hard way, I guess. Have fun with the lv!
Ignore the coloring code.

Option Explicit

Private Sub Form_Load()
ListView1.FullRowSelect = True
ListView1.View = lvwReport
Dim itmX As ListItem ' Create a variable to add ListItem objects.
Dim clmX As ColumnHeader ' Create an object variable for the ColumnHeader object.
' Add ColumnHeaders.
Set clmX = ListView1.ColumnHeaders.Add(, , "Column 1", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders.Add(, , "Column 2", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders.Add(, , "Column 3", ListView1.Width / 3)

ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.
ListView1.View = lvwReport ' Set View property to Report.

' Add a main item
Set itmX = ListView1.ListItems.Add(, , "First value")
' Add two subitems for that item
itmX.SubItems(1) = "First value subitem 1"
itmX.SubItems(2) = "First value subitem 2"

' Add another main item
Set itmX = ListView1.ListItems.Add(, , "Second value")
' Add two subitems for that item
itmX.SubItems(1) = "Second value subitem 1"
itmX.SubItems(2) = "Second value subitem 2"

' Add another main item
Set itmX = ListView1.ListItems.Add(, , "Third value")
' Add two subitems for that item
itmX.SubItems(1) = "Third value subitem 1"
itmX.SubItems(2) = "Third value subitem 2"

ReDim Preserve clr(ListView1.ListItems.Count)
'Initialise the subclassing
g_MaxItems = ListView1.ListItems.Count - 1
g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub

Private Sub Form_Unload(Cancel As Integer)
SetWindowLong hWnd, GWL_WNDPROC, g_addProcOld
End Sub

Private Sub ListView1_Click()
If ListView1.SelectedItem.Index < 0 Then Exit Sub
SetLIBackColor ListView1, ListView1.SelectedItem.Index, vbRed
End Sub

Hello,
Thank you for your reply. :)
But I want to make something like this:

http://img465.imageshack.us/img465/6274/vb6ox9.jpg (http://img465.imageshack.us/my.php?image=vb6ox9.jpg)

where the upper TextBox contains text data, and I want to edit that data on Run-time, then press a button to make TextBox list appear in ListView list, each value in LV coming from a single line of text in TextBox, and each SubItem coming from a single text line after commas.

"1234567890",60,11
to
value:"1234567890" subitem1: 60 subitem2: 11

I hope you can help me.

Regards :)
NTxC
NTxC at 2007-11-9 19:37:29 >