Help Needed How I Create Listbox That Look Like Multi Column Listbox 
Author Message
 Help Needed How I Create Listbox That Look Like Multi Column Listbox

 want to create Listbox that will show like the next format

Code       Name        Location
100         Name1      Box1
102         Name2      Box1
103         Name3      Box1
104         Name4      Box1
105         Name5      Box1

my problem is that the strings are not the same size so it look messy
in C we solve this problem by useing Tabstops
C code
   BaseUnit = (int)GetDialogBaseUnits();
   nTabStops=2;
   vTabStops[0]=BaseUnit*3;
   vTabStops[1]=vTabStops[0]+BaseUnit*3;
   SendDlgItemMessage(hDlg,LB_TESTS,LB_SETTABSTOPS,(WORD)nTabStops,(      
                              DWORD)(LPSTR)vTabStops);

I dont know how to create the same thing in vb
Any help will be greatly appreciate.

--
Avner Belisha



Fri, 14 Jan 2000 03:00:00 GMT  
 Help Needed How I Create Listbox That Look Like Multi Column Listbox

Use a listview and set the view property to '3 -
lvwReport. It looks just like a listbox except
you have columns that you can resize
--
Renee Langan
DFM Associates



Fri, 14 Jan 2000 03:00:00 GMT  
 Help Needed How I Create Listbox That Look Like Multi Column Listbox

Here's the VB code:

----------------------------------------------------------------------------
--

Option Explicit

'**********************************
'**  Constant Definitions:

#If Win32 Then
Private Const LB_SETTABSTOPS& = &H192
#Else
Private Const LB_SETTABSTOPS& = (WM_USER + 19)
#End If 'WIN32

'**********************************
'**  Function Declarations:

#If Win32 Then
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA"
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
Any)
#Else
Private Declare Function SendMessage& Lib "user" (ByVal hWnd As Integer,
ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any)
#End If 'WIN32

Private Sub Form_Load()
  ' the array containing the locations
  ' of the tab stops
  Dim lTabStops(0 To 3) As Long

  ' the number of tab stops
  Dim iTabStops As Integer

  ' set the tab stop locations
  lTabStops(0) = 25
  lTabStops(1) = 25
  lTabStops(2) = 25
  lTabStops(3) = 25

  ' set the number of tab stops
  iTabStops = 4

  ' last but not least, set the tab stops
  SendMessage List1.hWnd, LB_SETTABSTOPS, iTabStops, lTabStops(0)

  ' add some test items
  List1.AddItem "A" & Chr$(9) _
              & "BB" & Chr$(9) _
              & "CCC" & Chr$(9) _
              & "fred" & Chr$(9) _
              & "vb"

  List1.AddItem "vb" & Chr$(9) _
              & "fred" & Chr$(9) _
              & "CCC" & Chr$(9) _
              & "BB" & Chr$(9) _
              & "A"

  List1.AddItem "1" & Chr$(9) _
              & "22" & Chr$(9) _
              & "333" & Chr$(9) _
              & "4444" & Chr$(9) _
              & "99"
End Sub



Fri, 14 Jan 2000 03:00:00 GMT  
 Help Needed How I Create Listbox That Look Like Multi Column Listbox

You can do the same on VB, declare the SendMessage API function and do:

Dim Tabs(0 to MaxTabStops) as Long
Dim nTabStops as Long

nTabStops = 2
Tabs(0) = 10
Tabs(1) = 20
SendMessage (YourControl.hWnd, LB_SETTABSTOPS, nTabStops, Tabs(0));

Hope this helps.



Quote:
>  want to create Listbox that will show like the next format

> Code       Name        Location
> 100         Name1      Box1
> 102         Name2      Box1
> 103         Name3      Box1
> 104         Name4      Box1
> 105         Name5      Box1

> my problem is that the strings are not the same size so it look messy
> in C we solve this problem by useing Tabstops
> C code
>    BaseUnit = (int)GetDialogBaseUnits();
>    nTabStops=2;
>    vTabStops[0]=BaseUnit*3;
>    vTabStops[1]=vTabStops[0]+BaseUnit*3;
>    SendDlgItemMessage(hDlg,LB_TESTS,LB_SETTABSTOPS,(WORD)nTabStops,(    
>                               DWORD)(LPSTR)vTabStops);

> I dont know how to create the same thing in vb
> Any help will be greatly appreciate.

> --
> Avner Belisha




Sat, 15 Jan 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help Needed How I Create Listbox That Look Like Multi Column Listbox

2. Help Needded How I Create Listbox That Look Like Multi Column Listbox

3. Need good multi-column listbox control

4. need multi-column listboxes with same data

5. Need True Multi-Column Listbox ocx

6. View One column of Multi Column Listbox

7. Checkbox in multi-column listbox or grid column?

8. Multi-column listbox w/3 columns of checkboxes

9. Multi-column listbox w/3 columns of checkboxes

10. Multi-column ListBox Help Please?

11. Multi Column ListBox Help

12. Help/suggestion for 3rd party grid or multi-column listbox

 

 
Powered by phpBB® Forum Software