472,965 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

datagrid combobox question

Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug
Nov 21 '05 #1
6 1728
Hi,

There is only one combobox for the column that is shown on the row
that is being edited. You should add each item to the combobox manually.
If you bind the data you will wind up changing the values in multiple rows.

Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug

Nov 21 '05 #2
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to
Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations
data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the row
that is being edited. You should add each item to the combobox manually.
If you bind the data you will wind up changing the values in multiple rows.
Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug

Nov 21 '05 #3
Hi,

Say you have 50 rows in that column there is only one combobox that
is displayed when a cell in the column goes into edit mode. If you bind the
combobox you will wind up changing values in rows that arent being edited.
So what you need to do is just before the combobox is displayed you need to
clear the list and add the filtered items.
Ken
----------------
"Doug Bell" <dug@bigpond> wrote in message
news:uO**************@TK2MSFTNGP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to
Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations
data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the row
that is being edited. You should add each item to the combobox manually.
If you bind the data you will wind up changing the values in multiple rows.
Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug


Nov 21 '05 #4
Ken,

I am still not sure what you are saying.

My combo box is bound to data not a string list and it is setting the value
just for the row that it is displayed within

I already have a datagrid with a combo box.
The Data Grid is bound to the "OrderDetails" Table.
The Combo Box is bound to the "Locations" Data Table.

When I set a value (ie a Location) in the DataGrid using the combo box, it
is setting the selected location for that record (Order Details Line ) only.
It is not affecting the other records (Rows) in the data Grid or in the
underlying Data Table ("OrderDetails")!!

I want to know if I can set the bound DataView to filter for the value
within the row rather than setting it as a column style.

Or is there some other way to achieve this result.

Say the datagrid is displaying records filtered for Order No 12345678 and it
has 10 lines.

Some of Line 3 might have arrived so the User has to accept say 20 boxes and
allocates them to location A20.
He selects row with Line: 3, Item: AA12345, Description: Blue Plastic,
Units: Boxes, Expected: 50, Received:
5,................................................ ...........Qty Accepted:
[20], Location: [A20]

He entered the value 20 and selects the location 'A20' using the combo box.

Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OX**************@TK2MSFTNGP12.phx.gbl...
Hi,

Say you have 50 rows in that column there is only one combobox that is displayed when a cell in the column goes into edit mode. If you bind the combobox you will wind up changing values in rows that arent being edited.
So what you need to do is just before the combobox is displayed you need to clear the list and add the filtered items.
Ken
----------------
"Doug Bell" <dug@bigpond> wrote in message
news:uO**************@TK2MSFTNGP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to
Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations
data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the row that is being edited. You should add each item to the combobox manually. If you bind the data you will wind up changing the values in multiple

rows.

Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row basis.

Can someone help.

Thanks

Doug


Nov 21 '05 #5
Ken,
Sorry the Combo is not bound to the Locations Table.
The Locations Table is the datasource for the Combo Box.

The combo Box is bound to the Location field in the Order Details Table.

Does this make more sense?

"Doug Bell" <dug@bigpond> wrote in message
news:eE**************@TK2MSFTNGP12.phx.gbl...
Ken,

I am still not sure what you are saying.

My combo box is bound to data not a string list and it is setting the value just for the row that it is displayed within

I already have a datagrid with a combo box.
The Data Grid is bound to the "OrderDetails" Table.
The Combo Box is bound to the "Locations" Data Table.

When I set a value (ie a Location) in the DataGrid using the combo box, it
is setting the selected location for that record (Order Details Line ) only. It is not affecting the other records (Rows) in the data Grid or in the
underlying Data Table ("OrderDetails")!!

I want to know if I can set the bound DataView to filter for the value
within the row rather than setting it as a column style.

Or is there some other way to achieve this result.

Say the datagrid is displaying records filtered for Order No 12345678 and it has 10 lines.

Some of Line 3 might have arrived so the User has to accept say 20 boxes and allocates them to location A20.
He selects row with Line: 3, Item: AA12345, Description: Blue Plastic,
Units: Boxes, Expected: 50, Received:
5,................................................ ...........Qty Accepted:
[20], Location: [A20]

He entered the value 20 and selects the location 'A20' using the combo box.
Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OX**************@TK2MSFTNGP12.phx.gbl...
Hi,

Say you have 50 rows in that column there is only one combobox

that
is displayed when a cell in the column goes into edit mode. If you bind

the
combobox you will wind up changing values in rows that arent being edited.
So what you need to do is just before the combobox is displayed you need

to
clear the list and add the filtered items.
Ken
----------------
"Doug Bell" <dug@bigpond> wrote in message
news:uO**************@TK2MSFTNGP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the

row that is being edited. You should add each item to the combobox manually. If you bind the data you will wind up changing the values in multiple

rows.

Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row basis.

Can someone help.

Thanks

Doug



Nov 21 '05 #6
Doug,

You have normally to use a datarelation for that, are you able to do that?

Cor
Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
2
by: Robert | last post by:
I'm sure this is a fairly basic question, but I've been looking all over the web for days for suggestions on how to do this. I've got a datagrid that's bound to a dataset on my form. It includes...
3
by: Doug | last post by:
Hi I have the following code (not mine) that populates a datagrid with some file names. But I want to replace the datagrid with a combo box. private void OnCurrentDataCellChanged(object sender,...
4
by: Jan Nielsen | last post by:
Hi all I'm a former Access developer who would like to implement a many-to-many relation in about the same way you do in Access: With a subform and a combo box. Is it possible to use a...
13
by: Saber | last post by:
I did a lot of searches and read something about datagrids. But I couldn't find the answer of my simple question, how can I show only my desired columns of a table? for example I wrote this sql...
0
by: zhuang | last post by:
Hi, Adding combobox to datagrid has been posted many times. I have a datagrid which has multiple combobox columns and normal textbox columns. But how could I change other combo box values at...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.