473,413 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

help with listbox alignt eg. {0,-1}

1
Hi, my problem is am doin a listbox aligning different data like name space number space whatever so i cant get the lists straight... How do i do that??
Dec 10 '07 #1
1 996
devonknows
137 100+
Hi, if im correct in thinking your trying to make columns? yes? The reason by putting space 'chr(32)' wont work is each letter has its own dimensions etc etc you get the idea so nothing can line up directly.

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Private Const LB_SETTABSTOPS = &H192
  3. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As _
  4.         Long, ByVal wParam As Long, lParam As Any) As Long 
  5. '//Change OBorder to how many colums you require
  6. Const OBorder = 1
  7. Private Tabulator(1 To OBorder) As Long
  8.  
  9. Private Sub Form_Load()
  10.     '//If You Change OBorder higher than one than you need to set the left values of the 
  11.     '//Tabulator's array (Ive Inserted a few commented for an example) - 
  12.     Tabulator(1) = 50
  13.     'Tabulator(2) = 150
  14.     'Tabulator(3) = 250
  15.     '//This Will Call the function that will set up the tabstops
  16.     Call MakeList 'This Subroutine sets the listbox up
  17. End Sub
  18.  
  19. Private Sub MakeList(lstbx as ListBox)
  20.   ' Clear the ListBox, set new tab stops and add values
  21.   lstbx.Clear
  22.  
  23.   SendMessage lstbx.hWnd, _
  24.     LB_SETTABSTOPS, OBorder, Tabulator(1)
  25. End Sub
  26.  
Every column you add (OBorder) you will have to add vbTab inbetween for example if you set OBorder to 3 (4 Columns) you would use this...
Expand|Select|Wrap|Line Numbers
  1. List1.AddItem "Column1 Text" & vbTab & "Column2 Text" & vbTab & "Column3 Text" & vbTab & "Column4 Text"
Which Would Look Like This:
(Ignore the ____, Just there to show the space between columns)

Column1 Text ____ Column2 Text ____ Column3 Text ____ Column4 Text


Hope This Helps ya
Devon
Dec 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vengeance | last post by:
On the parent_form.aspx I have these controls <asp:listbox id="Operators" runat="server" Width="163px" SelectionMode="Multiple" Rows="2"></asp:listbox> <INPUT class="loButton" onclick="java...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
7
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
5
by: Melissa Cowan | last post by:
I am using Access 2000. I have the Developer's handbook and got the code for the mulit select listbox from there. It sends the selected value to another listbox, lstselected. What I need to do is...
0
by: David J | last post by:
Hi, I am strugling with the propertygrid and a listbox. I am using the universaldropdowneditor from the codeproject (code below). However I am populating the listbox via a datasource. The problem...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
0
by: Alex | last post by:
Subject: Help with DoDragDrop event? From: Alex <me112006@test.com> Newsgroups: microsoft.public.dotnet.languages.csharp Hi all, I'm having a problem with drag/drop on listboxes... ...
2
by: Phijo | last post by:
Hello, I am writing a page (C#) that uses one ListBox that retrieves data from a DB using SqlDataSource and the SelectCommand. <asp:SqlDataSource ID="DataSource1" SelectCommandType=Text...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.