Home All Groups Group Topic Archive Search About

Control similar to MS Access List Box

Author
10 Mar 2006 4:37 PM
Sandy
Hello -

I'm upgrading an app from MS Access to VB 6.  I have used a List Box in
Access that has columns and column widths.

Is there some equivalent control in VB 6?  I've tried various Listboxes I
found in VB 6, but none of them have the column width property.

Any help will be greatly appreciated!
--
Sandy

Author
10 Mar 2006 4:50 PM
Bob Butler
"Sandy" <Sa***@discussions.microsoft.com> wrote in message
news:1020923F-BC4B-48D4-A8C3-CC584A944705@microsoft.com
> Hello -
>
> I'm upgrading an app from MS Access to VB 6.  I have used a List Box
> in Access that has columns and column widths.
>
> Is there some equivalent control in VB 6?  I've tried various
> Listboxes I found in VB 6, but none of them have the column width
> property.

A ListView or a grid control might be a workable replacement.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
10 Mar 2006 6:23 PM
Ken Halter
"Sandy" <Sa***@discussions.microsoft.com> wrote in message
news:1020923F-BC4B-48D4-A8C3-CC584A944705@microsoft.com...
> Hello -
>
> I'm upgrading an app from MS Access to VB 6.  I have used a List Box in
> Access that has columns and column widths.
>
> Is there some equivalent control in VB 6?  I've tried various Listboxes I
> found in VB 6, but none of them have the column width property.
>
> Any help will be greatly appreciated!
> --
> Sandy

You can find the ListView Bob mentioned by selecting Project/Components,
scrolling down to 'Microsoft Windows Common Controls 6' and placing a check
in the box. You'll have to package this component with your app when you
deploy it. To get an idea of what it looks like, open Windows Explorer. The
side that shows the files and has column headers that say "Name", "Size",
"Type", etc.... that's a ListView (actually a SysListView32 but it
looks/acts the same)

There's quite a bit of difference in syntax when compared to a ListBox but
once you get the hang of it, it's a breeze.
'========
Private Sub Form_Load()
   Dim i As Integer

   With ListView1
      .View = lvwReport '<-- for ListBox look/feel
      .ColumnHeaders.Add , , "Item" 'Must have headers
      .ColumnHeaders.Add , , "SubItem"
      'Even though there has to be headers for each column
      'it doesn't mean you have to see them...
      'Uncomment the line below to hide the headers if you want
      '.HideColumnHeaders = True
      For i = 1 To 10

         With .ListItems.Add 'first column is a ListItem
            .Text = "Item " & i

            With .ListSubItems.Add 'all other colums are ListSubItems
               .Text = "SubItem " & i
            End With

         End With

      Next

      'You can select one using syntax similar to....
      Set .SelectedItem = .ListItems(10)

   End With

End Sub
'========

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Author
10 Mar 2006 9:35 PM
Karl E. Peterson
Sandy wrote:
> I'm upgrading an app from MS Access to VB 6.  I have used a List Box
> in Access that has columns and column widths.
>
> Is there some equivalent control in VB 6?  I've tried various
> Listboxes I found in VB 6, but none of them have the column width
> property.
>
> Any help will be greatly appreciated!

You can set tabstops within an ordinary Listbox.  Check out the CoolTabs
tool here:

   http://ccrp.mvps.org/download/cooltools.htm

Later...   Karl
--
Working without a .NET?
http://classicvb.org/
Author
11 Mar 2006 4:45 PM
Sandy
Thanks, All!
--
Sandy


Show quoteHide quote
"Sandy" wrote:

> Hello -
>
> I'm upgrading an app from MS Access to VB 6.  I have used a List Box in
> Access that has columns and column widths.
>
> Is there some equivalent control in VB 6?  I've tried various Listboxes I
> found in VB 6, but none of them have the column width property.
>
> Any help will be greatly appreciated!
> --
> Sandy