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




How To Add A Combobox For A Column In A Datagrid


Hi there..
How to add a combobox for a column in a datagrid or dbgrid ..for example in the access tables you can have a pull down list/menu..

The way i add a combobox for a datagrid or dbgrid is to add a separate combobox to the form....

if dbgrid/datagrid has column named product id, when the the user clicks on the column the combobox .left and .height and .top is set to the values of the datagrid.

what it does is it positions the combo box on top of the column in the datagrid.. unfortunately this is not a very easy way of doing..and it does not look good..

is there any other way for me to add a combo box to the datagrid.. doesnt the datagrid/dbgrid has a built in sort of combobox..

Thanking you guys in advance for helpig out..

regards pragash..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Move The Cursor From One Column To Next Column In Datagrid
Hi
Everyone,    
    In Datagrid control, how the cursor move from one column to another column of the same row after updating the datagrid.
    plz anyone help me.
    
    thanking you in advance.

Combobox Column
i used a component called Microsoft Form 2.0 Object Library and i used a combobox that are builtin in said library, on the properties of combobox there's a .columnCOunt property. just want to know the correct systax for that. coz i'm trying to get two fields from my database and load it to that combobox. Anyone has an idea how to use that combobox? THanks

Two Column Combobox
Hi,

Anyone know how to make VB combobox able to display two column of data and can return either column value when user select it (just like the one in VFP)?

If the one ship by VB can't do so, any other 3rd party control can do this?

Thx very much!!

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.

Column Headers In A ComboBox
Hi.
VBA - Access

I have been working on a way to put all the headers from a Table called "Data" into a combobox. The column headers aways change so i cant just add them.

Ive been trying to write a SQL statement but i never did SQL in my studies. But i think it would be the best way to do it. So an examples on this would be great.

Thanks.

Why Won't My Combobox Show The First Column?
Okay, so I have this combo box on a subform that has three columns in it. The first column, which is the bound column, will not display in the drop down list. It's data source is a query that pulls 3 fields from a single table, and all of the fields show up there. Once I choose a record in the combo box, the correct value shows up in the combo box.

Any ideas on what is going on?

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

Dual Column ComboBox
Hello Everyone,

Ive been seaching around here for some information on comboboxes that hold different values in different columns. What I am looking for is a Combobox that is filled kinda like the following

|___________________________|
| CompanyName1 | ContactName1|
| CompanyName2 | ContactName2|
| CompanyName3 | ContactName3|
| CompanyName4 | ContactName4|
| CompanyName5 | ContactName4|
____________________________

One post I read showed filling this combobox as follows:


Code:
Me.ComboBox1.AddItem
Me.ComboBox1.List(0, 0) = "CompanyName1"
Me.ComboBox1.List(0, 1) = "ContactName1"

Me.ComboBox1.AddItem
Me.ComboBox1.List(1, 0) = "CompanyName2"
Me.ComboBox1.List(1, 1) = "ContactName2"

My question is:
I have two tables in an access database. I want to fill the Company Name from one table in the left column, and the Corresponding Contact in the right column. Both tables have a related field being Company ID.

I am currently using the following code to fill a combobox with just company names:


Code:
While Not rsCustomer.EOF 'Loop through all records in recordset
With rsCustomer
Combo2.AddItem rsCustomer!CompanyName
.MoveNext
End With
Wend

I guess I could fill my combobox like this although I havent tried it yet as I just now thought of it while I was writing this post.


Code:
While Not rsCustomer.EOF 'Loop through all records in recordset
With rsCustomer
Combo2.AddItem rsCustomer!CompanyName & " - " & rsCustomer!ContactName
.MoveNext
End With
Wend

What would be the best way to display the data in a combobox. Using the ComboX or the ComboBoxX.

Thanks in advance. If anything is unclear please let me know.

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.

Adding Another Column To A ComboBox
Greetings,

I have a combo box on a form which I am automatically
filling in with items that have an assoicated page number.
For Example:
Utilities is Page 2
Approach is Page 3
Abutments is Page 4

In the combo box the list items are sorted in alphabetical order:
Abutments is page 4
Approach is page 3
Utilities is page 2

I need to add another column to the combo box to store the
page number, can anyone tell me how to add this second
column and then fill it with the proper page number?

In addition the second column needs to be hidden from the
user but accessible to code. I have tried using the combo box found in Micrsoft Form 2.0 Object Library but it just doesn't fit cut it.

I can not use a array or a recordset to do this because
the search cabilities are just to slow for the amount
of data I am dealing with.

Thank you in advance for your help.

Could Not Get The Column Property. ComboBox
Hi,

I have a problem with a ComboBox, I fill the listbox with data (two cloumns, name and identifier) and the user shall choose one of the post in the Listbox.

But if the user print something else and press GO I wold like to be able to pick up that and exit the sub.

Some thing like this
CODEIf cboOrt.Column(2) Is Nothing Then
 MsgBox "NĂ¥gonting gick snett, orten hittades inte"
 Exit Sub
 End If

Multiple Column Combobox
I want to know if there is a Combobox Object that can store multiple columns but the other columns should not be displayed.

Combobox Column Heading
Does anyone have a work around or know of a 3rd party control for putting a column heading in a combobox, that is on a form in Excel, populating the dropdown from an access database? There is an article on Microsoft ID:Q164343 explaining the problem.

Combobox - Hiding Bound Column
i have a cbox that holds 4 columns. The first is merely the key which i need as the bound column. It is now set up so all 4 columns are visible and when the user makes a choice only the 1 bound column is visible. Is it possible to hide the 1st column evn though it is bound and instead of seeing that field after choice see the other 3???

Thanking You

How To Add Column Headers In Msforms Combobox
hi,

iam not able to add recordset field names to the column header of msforms.combobox.Pls help me

Thanks in advance

Dorathy

Grid Having Combobox As Column Header
I would like to display data on a grid having column headers. When I click on the column header, I should be able to sort records according to data on that column. All these can be achieved using List View.
Is it possible to have a combobox containing the values of the column. When I choose any value it should display records for that value only.
ie. if the first column contains Ford,Gmc,Toyota.....
When I select Ford, only data containing Ford in the first column should appear.

Combobox Column In Data Grid In Vb 6.0
Hi,

Can anyone tell me how to insert a combobox in a datagrid.
My requirement is that i have a datagrid that has 3 columns.The
datagrid data is fetched from the database using a ADODB
recordset.Based on the no. of rows in the datagrid i should
insert a combobox in all the cells of the first Column of the
datagrid.Each of the Combo box should be filled with all the
items in the first column .

can anybody send me the code to achieve this.Thanks in advance.

Regards,
Kiran K

Possible For DBGrid Column To Have Both Combobox & Texbox?
I have been asked to create a DBGrid which has a third column which has comboboxes for all but the last row. The last row is to have a testbox like cell where the user can enter freeform text. Is this possible? If so, how can it be done?





Multiple Column Listbox/ComboBox
How can i display the record (Product Code and Product Description) from the database into the ListBox/ComboBox? The purpose of i'm doing this is to select the entire product from the listbox later.

e.g:
Product Code Product Description
============ ====================
A001 Burger
A002 Cheese
B001 Coke

Thanks if anyone can give me a hand on it...thanks..

ComboBox Supports Multi Column
Anyone give me a ComboBox Control support multi column(Free).
Thanks alot.

Who Was Challenge That Make A Combobox That Has Many Column And Rows?
How can you make a combo box that has many rows and columns?
Do you know the reference for it in how to make?

If you click the drop dow it will show different items which is columns like the example below.

ID | Name | Address | etc.|

Setting ComboBox Items To A Column In A Database
I'm looking to set the item list for a comboBox from a column in my database. How can this be done?

Add Column To Datagrid
Hi everybody; I hope one of you can help me.

I am displaying a table with a datagrid and want to add a column with the values from another table as it's contents.

Both tables have columns titled CODE. The second table has a field called TYPE that corresponds to the CODE (eg. CODE 101 means TYPE Maintenance). What I want to do is put the values of TYPE from the second table into the datagrid displaying the first table I'm not allowed to add a column into the table being displayed by the datagrid.

I'm connecting to the database thru Adodc (DISA for the first table; CODES for the second table)

I found this but when I try to populate the fields from the second Adodc (CODES) it doesn't work. I figure that's because the Datagrid1 is connected to DISA.

Private Sub AddColumn()
Dim c As Column
Set c = DataGrid1.Columns.Add(DataGrid1.Columns.Count)
With c
.Visible = True
.Width = 1000
.Caption = "type"
.DataField = CODES.Recordset.Fields("CODE").Name

'if i use .DataField = DISA.Recordset.Fields("WHATEVER").Name it
'puts the values from 'WHATEVER' into the column "type"

.Alignment = dbgRight
End With
DataGrid1.ReBind
End Sub

Any ideas?? Thanx in advance.

Set DataGrid.Column Value
Hi,

ive got a Problem with my data grid, i have a DataGrid where the Data Source is an DataEnvironment, allright it works, but now i want do add a column to that grid where i calculate fe: Column1 * Column2 but if i want to insert the value in the column with: DG.Columns(3).Value an error apears:

Column not found, |1

what have i to do to do that???

Column In Datagrid
Hi,
I have a datagrid that bind to a table. Some of the columns of the table are not editable. For those columns in the datagrid, I want to gray them out.
The datagrid property does not give enough tools for me to set up.

Please show me how.

Thank you,

Quang

Datagrid Column
On a form I have a datagrid...how do i specify the column width for each seperate column??

Datagrid Column
I don't want my identity column to show up in my datagrid. How do I control which columns I want visible and which ones I don't?

How To Add Column To Datagrid
Anyone know how to manually add a column to a datagrid.

The default value of the grid when you create the object is to only have two columns, I need 13. Thanks


Nightfox02

Datagrid Column Sum
I have a column in datagrid that displays all the prices. I want to sum up all the values from all the rows of that column and display it as a label. How can I sum up the data??

Thanks ... Bhavesh

Add Column To DataGrid
I am new to working with grids and cannot figure out how to add a column.
The grid is a DataGrid ActiveX Contol - Version 6.0. I can look at the
properties and code but cannot see where to add the column.

I appreciate your help.
Kevin

Add A Column In A Datagrid
I would like to know if it is possible to add a column in a datagrid.
I would like to have a column to describe all line in my datagrid.
By the way, is it possible to display a long text in the header on two line but in the same cell.
For example I have the text "this is my new cell"
And I would like that it display like that:
"this is my
new cell"
because I don't want that my columns have a width of 4000

Thanks in advance

How To Add A New Column Into A Datagrid ?
Hi,

I have a datagrid1 on my screen. I have a recordset myRst contains 3 fields (id, name, age). I set myRst as the datasource for my datagrid.
     set DataGrid1.datasource = myRst

Then I want to add a new column into this datagrid1, which can show info depend on the value of AGE. for example, if age < 12, show 'KID'; if 13 <= age <= 25, show 'Tenage'....
        
        DataGrid1.Columns.Add (3)
        DataGrid1.Columns(3).Width = 350
        DataGrid1.Refresh

Now i want to populate this new column using following code:

myRst.movefirst
do while myrst.eof = false
    with datagrid1
        if .columns(2).value < 12 then
            .columns(3).value = "kid"
        ......
        end if
    end with
    myrst.movenext
loop

When i ran the program, first 3 columns populuated successfully, but last column is empty, and I got following error:
        Column not found, /1

What does this mean?

 
Grace

How To Get The Column Name Of Datagrid
Is there anyone know how to get the number of columns and its corresponding name of datagrid and put it in list box or variable.

Or there's another option except datagrid which get the field name of a table.

Note: I only knew the name of the table but i dont know its field name.


Thank you very much for your reply.

Datagrid Column Sum
I am trying to find a way to sum the values of a column in my datagrid. I have not even found a way to isolate a single cell, row coordinate. Please help.

Datagrid Column Sum
I have a column in datagrid that displays all the prices. I want to sum up all the values from all the rows of that column and display it as a label. How can I sum up the data??

Thanks ... Bhavesh

Datagrid Column Sum
I have a column in datagrid that displays all the prices. I want to sum up all the values from all the rows of that column and display it as a label. How can I sum up the data??

Thanks ... Bhavesh

How Can I Get The Column Name Of The Datagrid
I want to get the name of the column when I double-click that column in a datagird control
how can i do it?
Thank u

Fetching Table Column Values In To The Combobox Control
Hi all,

I had a requirement where I have 5 radio buttons where each radio button corresponds to one particular table. If i select a radio button , the combobox should be populated with the table column's values. (This table comes from the radio button selected).


I would be thankful if anybody provides me a way that is needful.


regards

Murali

Picking Related Column From Table In A ComboBox Selection
Hi,

I need help.

My VB6 program populates a combo box (from a table with customers' name) for users to select. On user's selection, I have to pick customer-code (primary key in the same table). Can some one help me how I could do that?

Thanks in advance.

How Do I Dynamically Add Items To A Cell Of Datagridview In A Combobox Column
How do I dynamically add items to a cell of datagridview in a combobox column?

For example, if column1 in a datagridview is a combobox, dynamically I would like add items ("a","b","c", to row1 so that I can pick up any of these text and use in the future. for row2 may become "c", "d", "f". Thanks

DataGrid Column Width Value?
In this expression...

DataGrid.Columns.Item(iCol).Width = 1000

What type is '1000'?
Is it a Pixel, char...number.....etc....i cant figure it out......

the reason for this is I have a MSflex grid which has a column width of 20...i would like to know how to convert that number to the equiv in a datagrid..Please any help would be great. Thanks in advance

DataGrid Column Width Value
What is the Column Width Value Type.....ie... Pixels, Spaces, Points? etc...

Datagrid Column Control
I want to remove the column in my datagrid that shows the ID. How do you control which columns are visible?

Datagrid Column Width ????
I have two datagrids that are exactly the same. The only difference is that I am using them on different forms, and one of them has a filter.

My question is this.
On the first datagrid, I could write column widths like this
AppointmentsDataGrid.Columns("time").Width = 40
AppointmentsDataGrid.Columns("patient").Width = 150
AppointmentsDataGrid.Columns("Doctor").Width = 150
AppointmentsDataGrid.Columns("status").Width = 50
and the output was as I expected.

but then, on the second grid, when I write the same thing, the column widths get rediculously small. Is there a way of specifying the units used for the column widths that I have missed?

Jagdip

DataGrid - Format Of One Column
Set grdStock.DataSource = Adodc1
grdStock.Refresh
grdStock.Columns(0).Width = 900
grdStock.Columns(1).Width = 1700
grdStock.Columns(2).Width = 1700
grdStock.Columns(3).Width = 1700
grdStock.Columns(4).Width = 1700
rdStock.Columns(4).DataFormat = FormatCurrency(Price)

So I want to make column(4) with Format Currency. I tried this but does not work. Does anybody have idea how I can make this format in DataGrid?

Thanks,

Ilimax

Datagrid Column Question
I have a datagrid and would like all the cells in the first column to be "RECEIVE".
I've tried

DataGrid1.columns(0).text = "RECEIVE"

AND

DataGrid1.columns(0).value = "RECEIVE"

Neither worked

I was reading something about the DefaultValue property in my vb book that seems would work for my problem but ofcourse it has no examples. I also looked it up on the MSDN and it talks about using a Tag property, which I dont know how to use.

Datagrid Column Widths
I am using a datgrid, and looking for a way to "autosize" the column widths. Is this possible, or do I need to know the lenth of my data in order to set the column width?

Thanks

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