Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Vba To Add Items To A Multi Column List Box


Hi, i know there is a similer question to this in the archieves, but it did not answer my question.

I've got an access form, with two list boxes, which both are multi column. I want the user to beable to selected some rows form the first, and have it populate the 2nd. Heres what i've got so far...


Code:


Dim int1 As Integer
Dim int2 As Integer
lstList.SetFocus
int1 = lstList.ListCount
Dim i As Integer
int2 = 0
For i = 0 To int1
If lstList.Selected(i) = True Then
int2 = int2 + 1


lstAttend.AddItem (lstList.Column(0, i))
lstAttend.Column(1, int2) = lstList.Column(1, i)
lstAttend.Column(2, int2) = lstList.Column(2, i)
End If
Next


lstList is the original & lstAttend is the one im trying to fill, this gives me the error
"Object Required" and higlights the bold line.

any ideas of how to fix this?

Thanks
Patricia




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Adding Items To Multi Column VBA Listbox
how do I add an item to the second column of a listbox directly. I saw the example in the help that does it by equating it to an array, but I want to do it directly.

Thanks for any help!

Vba Multi Column List Box Value From Second Column
I have a multi column list box that has the state name in column 1 and the state abbrev in column 2. I want to return the abbrev of the items the user has selected. How can I do that? I have this so far.

Function FindCurrSelectedItems()
  Dim i, n As Integer
  Dim list() As Variant
  Dim lst As Object
  Set lst = ReportObjects.lstLevels
  n = 0
  lst.TextColumn = 2
  lst.BoundColumn = 2
  For i = 0 To lst.ListCount - 1
      If lst.Selected(i) = True Then
        ReDim Preserve list(0 To n) As Variant
        
        list(n) = lst.list(i)
        n = n + 1
      End If
  Next
  FindCurrSelectedItems = list
End Function

Multi Column List Box
Hi All,

I am trying to populate a list box with two columns. Can some one tell me how do I do that? There is an option to chose number of columns for the list box. But how do I add the values to the columns?

Here is what I am trying to do: I have a set of items which have history of costs. I need to add these items to a different projects every year. But when I am adding these items I need to look at the history of costs (how much it costed in previous years for the same item). I also need to display the history of costs in sorted years. User will then pick the cost from the history or will make a new entry for the present year.

The out put should appear like this:
Item:Misc
----------
Year Cost
----- -----
1999 $200
2000 $250
2001 $225

Can some one please help me? Is there any other way to approach the same problem other than using the list box?

Multi Column List Box
hi,
how can i make a list box with many columns, such as those to show the values in the registry with headers (Name, type, data... i think) is there a control that works like this? and if there is how do i use it?
thanks

Multi-column List
How can I get a multi-column list similar to thoes in windows explorer when you click views > details

I tried messing around with the column value of a listbox but that does not seem to be what I'm looking for.

Thanks in advance!

Multi Column List Box Thingy
Is there a built in way for visual basic to display a multiple column table as a list, with the grey headings at the top so you can order the information by clicking on them. This is so common in windows, but I cant find a control or a property that supports it.

Help much appreciated.

Multi Column List Box Thingy
Is there a built in way for visual basic to display a multiple column table as a list, with the grey headings at the top so you can order the information by clicking on them. This is so common in windows, but I cant find a control or a property that supports it.

Help much appreciated.

Dave.

Neat Multi-Column List Boxes
I'd like to be able to have a listbox with two columns, with titles are the top (like the one's in WinMX and Napster and things) I'd also like one of the columns to display icons. I've had no joy using the standard list box, or the tip on VBWorld for multi-column list boxes. Anyone got any ideas?

Populating Multi Column List Boxes In VB
Hi All,

This is going to sound like a really stupid question, but I can't find the answer on here or on the Microsoft site...

Basically I have a multi-column list box, which needs to be populated from a file read in a loop.  I can populate the first column fine, but how do I populate the other columns?

Cheers

Andrew

How To Get Selected Items From Multi-select List Box On Form In Excel.
Hello... I am having some difficulty getting the selected values from a multi-select list box in Excel. Here is my set up:

A sheet contains a button. The button envokes the form:
frmName.Show

On this form the user selects several values in a list box and hits another button. Here is my problem. In the code behind the _click button action of the form... I am unable to retrieve the values selected by the user... I have tried serveral things I found on the net but none of them seem to work...

does anyone have any example code or ideas here?

Thanks for looking,
brazilnut

Multi Row Column Title In List/Flex Grid
Hi,
Any idea how to display Column Headers in Multi Rows for Flex grid or List view


vemvas@aol.com

Excel VBA Multi-column List Box Scroll Bar Position Update
In Excel VBA I am using a multi-column list box that is bound to a range with the rowsource command. When there are more rows and columns in the range than can be viewed simultaneously, the list box automatically provides horizontal and/or vertical scroll bars. The problem is that whenever the content of a cell referenced by the rowsource is changed the horizontal and vertical scroll bars go back to the uppermost and leftmost positions.

If I am entering data into the cells through a text box and viewing the results through the list box, it becomes very confusing when the scroll bars keep resetting. Is there any way to force them to stay in their present position?

How To Copy And Modify Listview Column Items And Put It In Diffrent Column?
Hi all i got a listview with first column has songIDs i want to for each item in songId column to take its value and add http://localhost/new/play.php?d=04&song= to it and to make it http://localhost/new/play.php?d=04&song=1234 and fill url column. But i do not know . could any one help me achive this .thanks

Finding The Sum Of Two Column Items And Then, Then Sum Of Column (listview)
I have been working hard on this and I cannot get the sum (subtotal) to be right. Have tried many things and its just not cooperating. Please see screen shot attached.

Also, I have two test records in the DB and only one is showing which makes no sense.

Code below. Thanks in advance for any assistance.

VB Code:
Private Sub cmdViewAll_Click()    'view all time logs in database    'order the records by insert date        'open a connection to the database    MyMySQLConnection        'perform an SQL query on the database and order by the insert date    strSQLTimeLogViewAll = "SELECT * FROM TimeLog"        'open a recordset    OpenTimeLogViewAllRecordset        'populate the listview (lvwTimeLog)    With rsTimeLogViewAll        If .RecordCount = 0 Then            'do no populating        Else            Do Until .EOF = True            Dim LstTimeLog As ListItem                        'lets first clear the list view            lvwTimeLog.ListItems.Clear                        'populate the list view            Set LstTimeLog = lvwTimeLog.ListItems.Add(, , .Fields("JobNumber").Value)                LstTimeLog.SubItems(1) = .Fields("CompanyName").Value                LstTimeLog.SubItems(2) = .Fields("Category").Value                LstTimeLog.SubItems(3) = .Fields("Comments").Value                LstTimeLog.SubItems(4) = .Fields("StartTime").Value                LstTimeLog.SubItems(5) = .Fields("FinishTime").Value                'get the subtotal of subitems 4 + 5                Dim strFirstValue   As String                Dim strSecondValue  As String                Dim strValueTotal   As String                                'do the calculation                strFirstValue = LstTimeLog.SubItems(4)                strSecondValue = LstTimeLog.SubItems(5)                strValueTotal = Val(strFirstValue) + Val(strSecondValue)                                'add it to the last column                LstTimeLog.SubItems(6) = Format(strValueTotal, "HH:NN")            .MoveNext            Loop        End If    End WithEnd Sub

Saving Items (selected Items) In List Box To A Text File
I need help in coding the following:

1. Saving (or exporting) the items displayed in List Box to a text file.

2. I have a long list of data to be displayed. When I use this List box all of my data does not fit into the width. I was wondering if there is similar other way where I can do horizontal as well as vertical scrolling. I tried text box and its of no help i guess.

Add Multi. Items To Listbox From String
Hello All,

Here is my question...

I have a string (i.e. "you@domain.com,me@domain.com) and I would like to add that string to a list box, with the "," separating the items. I have been able to do this before (on accident), but for some reason I can't replicate the results... Any ideas?

Thanks much!

- Joe

Highlighted Items In Multi Select?
Hello, I am working with a list box that has multiple selct turned on, and all that I want to know is, is there a way to get all of the highlighted indexes in an array or a collection or something. I realize that it you could do it by trapping every click event and adding or removing an element from a collection, but is it possible to do without doing this?
Thanks a lot.
~evlich

Multi-column Listbox ,please Help!
Hello

i want to make a listbox with 2 or 3 columns. Ive googled everything but cant find the good answer

All i want is a code that add some data to a listbox like

_List1__________________________________________
| name | username | Country | email |
| opti | optiplex | NL _____| *****@hotmail.com|

please help me!

Combobox Multi Column
hello guyz! its good to be back again.

I just want to ask if any of you has tried to experiment a code in VB to make it multi-column. In Visual FoxPro 8, combobox is already multi-column. I badly needed this kind of control wich can hold as many columns as i wanted it.

This is a sample data that i want to store:

BrandCode,Description
0001 - Brand A
0002 - Brand B
etc...

I hope u can help me here guyz. And if u huv other controls that work like as what i wanted, please tell me so.

Your help is very appreciated.

Multi Column Combo
In Access you have the option of setting your drop down
combos so that they can display several columns of
information.

I'm using VB6 and would like to do exactly the same.
Unfortunately the combo control in VB6 does not have a
columns property. Does anyone know how I can do this or
know of an active X control I can use.

VB6: Multi-column Listbox -- How To?
Just came across this board and browsed through as much of the history as I could. I was not able to find the answer to my query however, but perhaps someone knows?

I have worked with VB for Applications in Office 2000 before, but am currently working on my first real program in VB6. I need to write an interface to work with a Access database that is residing on a central server.

This is probably a pretty simple thing to do, but I can find no easy way to do it in VB6:

- get data from several related tables in the database
- manipulate this data
- put the data into a multi-colum listbox so the end user can scroll through it.

In Access 2000 this is done by setting the listbox's RowSourceType to a user-defined function, and then writing the fuction to return the data as needed. Essentially this function lets Access get the data to be displayed (in the form of a 2D array), the number of columns, width of columns, and the array position that should be displayed in each column. It is not as complex as it sounds!

Getting data out of my DB via ADO is no problem. But I can find not way to create a multicolumn listbox and then populate it with data out of the database. Would be very very good if I could manipulate the data before it appears in the listbox as well.

Does anyone have any thoughts on how to do this? Am I out of my mind?

I have dug and dug for this info, but no luck... Hope someone here already knows!

Ian

Multi-Column Listboxes
Is there any way to have a multi-columned listbox, not where the same field is "wrapped" around, but where multiple fields are next to each other and perfectly aligned?

In other words:

Item A ItemADescription ItemANumber
Item B ItemBDescription ItemBNumber
Item C ItemCDescription ItemCNumber
Item D ItemDDescription ItemDNumber

I have seen this in many windows based programs but have been unsuccessfull myself at figuring out how to do it.
Thanks!

Multi Column Combo
i have been using vb combo in my applications but now i need a multi column combo. i have been searching net for it and founf some of them but i am not sure which one to use coz i need it to be reliable and with better options if any body here having expreince in multi col combo please let me know.
Thank You In advance

Multi Column Listbox
I'm sorry but i cannot figure out how to get this to work (new to this). how do i simply add an item to the second column of a listbox?

Multi Column ComboBox
I need to display two or more records from SQL in cmbbox is this possible

Multi Column Combo Box
I've got a combo box with the Style set to 2 - Dropdown list currently. This combo box allows the user to select a Social Security number. What I want to add is an indicator to some of the SS#'s, depending on some other variable.

I've got some ideas on how to handle this with my current set of controls (like a flexgrid or something), but what I would like to know is if there is some setting or control already available that handles "multi-column" combo boxes.

Thanks.

Multi-Column ListBox??
I would like to have a Listbox containing 3 columns. Each column will be of a fixed length. Is this possible with a Listbox?

I can add items with the .AddItem method but it only adds the item to the first column. How do I add items to the middle and right column?

Thanks in advance!!

Multi Column Listbox
any one know how to address multiple columns in in a listbox?

Multi Column Combo Box
Code:
Private Sub Form_Load()
Dim ColN As Integer
ColN = 0
While Adodc1.Recordset.EOF = False
combo1.AddItem
combo1.List(ColN, 0) = Adodc1.Recordset.Fields!material_code
combo1.List(ColN, 1) = Adodc1.Recordset.Fields!material_name
ColN = ColN + 1
Wend
End Sub

This is the code to create a multi column combo box, it adds the details automatically. ColN is simply a Column Number that is incremented each time an item is added. However, I get an error message saying :
"Object Variable or With block variable not set"

Why?

Multi-column Combobox
With a ComboBox or DataCombo is it possible to show more than one column in the dropdown list?

If so, how? If not, then what could I use?

Combobox - Multi Column
Okie dokie this one is driving me nuts. vb6 combo boxies don't support multi column and I really really don't want to add additional complexity to this project by using third party tools or a whole bunch of code. Am simply trying to pad out three fields in a single combo item.

have tried


Code:

.additme FIeldOne & vbTab & FIeldTwo & vbTab & FieldThree



vb is quite happily throwing the tab character into the string, but is not using it tio position the fields. Anyone got a quick and nasty way around this. Figures spaces wont work

Multi Column Combobox
i want to use the multi column comboboxin a data grig how can i use thie.

Multi Column Textbox
Hi

I'm developing a chat application and would like to use a text area similar to that which is in the new Opera 7.5b IRC client.

It's like a text box with two columns, one for the chatters name and one for the chat text. Take a look at the attached screenshot to see what I mean.

Does anybody know of a way to accomplish this?

Thanks in advance.

Multi-column Combo?
Is it possible to have a combobox with 2 columns. One would have the string to save to th eDB, and the second would have a description for info, not to be saved.

I can do it in access (VBA)... Not sure about VB.


thanks

Multi Column Listbox
How do i pull data out of a multi column list box? I can get it in with no problem just can't seem to hit on the right code to pull it out. For instance I want the data that is in the first row, second column.

Thanks

Multi-column Combo Box
This should be a pretty simple question,

I have a 3 column combo box, where the first column is hidden. When the user makes a selection from the combo box, I can only get the 2nd column to show up, but I really need the 2nd and the 3rd column to show up when a selection is made. What properties do I need to modify, so that I can do this??

Multi-Column Combo Box
Has anyone found a third party control that handles combo box like MS Access does? I know there are ways around this in VB but I am looking for a easier solution. Thanks.

Multi Column Combo Box
hi,
i m looking for any multi column combo box with source code. but i didnt to get any free control or so.

can any one tell me any url for multi column combo box activex control with its source code???


thanx in advance,
firoz

Multi-column Listbox
Anybody know where I can get my hands on a multi-column listbox? The control or some source code? I've found some source code out there, but I didn't find anything that was easy to use. Any ideas?

Thanks.

FLL

Multi-column Combo
Can you put more than one coll in a combo.

Multi Column Listbox
reminder... i have never used a listview...


http://www.vbforums.com/showthread.p...ghlight=seahag


Seahag

Multi-column Combo Box
anyone knows how to put multiple columns in a DBCombo?

or is there any OCX that has this feature?

Multi Column Listbox
Dear all expert,

I am a new in using VB, Can anyone show me how to create a multi-column list box with header like a data-grid. I know VBA can do that, but I duno how I do that in VB.


BeeBee2

Multi Column Listbox
Is it possible to make a listbox with more than one column, like the one in find files and folder box that appears when you search for a file.

Please Help, i've asked before and had no joy!

Multi-Column Lists
Does anyone knows how to fill a Multi-Column List in runtime with information that is not in any database. Please if anyone knows, HELP ME!
Thanks for your time

Multi Column Combo Box Help
Somebody know how to use multicolumn combo box?
i have download that from this place
http://www.finaldownload.com/developer_tools_visual_basic_mccombox.html
but i dont know how to use that, please help me for use that
thanks for any help

Multi Column Listbox
Can anyone tell me how to fill a multi-coulmn list box in VB. I have a ADO
record set (say rs1) with 4 rows and 4 cols and I want to display this in a
list box. How do I do it?

For some reason, data gets filled in one below the other inspite of setting
the column value to 3 in the properties.

Multi Column Combo Box ?
HI

does anyone have any tips / code for populating a combo box so that it has about 4 columns worth of data, some of which are hidden? Trying to replicate an access combo box, can see how to do it for 2 columns by using the additem and itemdata methods. But 4 columns ?

Regards

BuilderSPec

Multi Column Combo Box
hai all,

i have a doubt in vb.

is it possible to have a multi column combo box.
actually my requirement is , i have to populate a combo box with values of 3 fields from my table. fields are item code, date from, date till.

based on the row i select from this combo box i have to fetch its other details.

i know how to do with single column combo, but not with multi column combo.

could any body clear my doubt. it is very urgent, please !!!!!!!!!!


thank u all,

lat.

Copyright 2005-08 www.BigResource.com, All rights reserved