Hello maybe you know how to show the table in the list box? for example I want to show this results in the list box:
vegetables fruits
Tomato apple
cucumber apricot
6 11559
Hello maybe you know how to show the table in the list box? for example I want to show this results in the list box:
vegetables fruits
Tomato apple
cucumber apricot
What VB are you using? VBA(if so, which application), VB6, or VB.Net?
If you are using VB.Net, you might want to consider using a ListView control instead: - Add a ListView control
- In the Design Mode, add two columns to the Columns property: Vegetables, Fruits
- In the form load event, you can load the rows:
- ListView1.View = View.Details
-
ListView1.Items.Add(New ListViewItem(New String() {"Tomato", "Apple"}))
-
ListView1.Items.Add(New ListViewItem(New String() {"Cucumber", "Apricot"}))
HTH --Sam
I use VB 6.0
Bummer! If I remember correctly, you'll have to do it yourself. In other words, you'll have to insert enough spaces so that it looks like you have columns. I also remember using multiple listboxes placed together so that they looked like a single multiple column listboxes. But coordinating selection/scrolling was a pain.
Maybe Killer will have some good suggestions when he arrives later this evening. I also be back to a VB6 machine in a couple of hours and I'll see if I still have any pseudo-column code.
Another thought: if you have Microsoft Office installed on your computer, then you should be able to add Microsoft Forms 2.0 ListBox to your form. Right-click on the toolbox and browse to \Windows\System32\FM20.dll, then add the ListBox to your project. With it you use the ColumnCount property. Here's some sample code, http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx. I'll see if it works for VB6 in a couple of hours. HTH --Sam
Forms 2.0 ListBox works!: - Dim lstArray(3, 2) ' three rows, two columns
-
ListBox1.ColumnCount = 2
-
lstArray(0, 0) = "Vegetables"
-
lstArray(1, 0) = "Tomato"
-
lstArray(2, 0) = "Cucumber"
-
lstArray(0, 1) = "Fruits"
-
lstArray(1, 1) = "Apple"
-
lstArray(2, 1) = "Apricot"
-
ListBox1.List() = lstArray
But, it has an annoying "feature:" the ColumnHeads only works if the control is getting the data from a RowSource & even then it gets the data before the RowSource ie, I think it will only work for Excel. But, the workaround is to just use Label controls for the headers. HTH --Sam
I undestood this way, but it was only example. Now I want to show two or more records of my access database in one list box. I wrote a code such as: - Private Sub Command4_Click()
-
List1.Clear
-
Set db = OpenDatabase("the path of my database")
-
Set rec = db.OpenRecordset("SELECT * From asmenu_info WHERE asmenu_info.Vardas in ('Eglë','Regina');")
-
While Not rec.EOF
-
List1.AddItem rec!ID
-
rec.MoveNext
-
Wend
-
rec.Close
-
db.Close
-
End Sub
With this code I can add only one record to my list. I want to show more than one record in the list box.
As far as I can see, the only reason this would be limited to a single record is if your WHERE clause does so. The While loop should add the entire recodset to the listbox.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: WindAndWaves |
last post by:
Hi Gurus
I was wondering if you can send me in the right direction:
I have a table with about 300 rows. I want to make all of them invisible
and when a user enters a code in a form then make...
|
by: Anne M |
last post by:
I have a report based on query..which is a team list with names and their
role on team ie coach, assistant and player.
Report is almost what I want and my knowledge is limited so I need some...
|
by: jeet_sen |
last post by:
Hi,
I have created a table colelcting data from an XML source.
After I built the whole table I ahve given user options to filter out
columns from the table.
For this I have collected all the...
|
by: gerbski |
last post by:
Hi all,
I am relatively new to ADO, but up to now I got things working the way
I wanted. But now I've run into somethng really annoying.
I am working in MS Access. I am using an Access...
|
by: basavaraj koti |
last post by:
I need to show image using xslt
Below provided in my xml and xslt.
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="../xyz.xsl"?>
<Grade class="03"...
|
by: bimeldip |
last post by:
Hi,
I have managed to create codes to display data from the database in a html page.I have gone on to create a page to allow users to manipulate the table via a html page. For instance users will be...
|
by: bimeldip |
last post by:
Hi,
I have managed to create codes to display data from the database in a html page.I have gone on to create a page to allow users to manipulate the table via a html page. For instance users will be...
|
by: banderson |
last post by:
Hello,
I have a data entry form for a table with information about buildings and am having a problem making a combo box do what I want. I would like to make the combo box show a list of unique bldg...
|
by: alex |
last post by:
I've converted a latin1 database I have to utf8. The process has been:
# mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore
--skip-set-charset mydb mydb.sql
# iconv -f...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |