472,989 Members | 3,039 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,989 software developers and data experts.

complex grid with comboboxes

I have a datagrid which has (amongst other stuff) 2 comboboxes columns.
So far so good. The trick is that when I select a value in my first
column, it must updates the items of the combobox in the second column
for the same row.

In the first column, comboboxes contain names of tables. In the second
column, comboboxes contain names of the fields in the table selected in
the first column.

Tricky uh ?

Does anybody have an idea ?

Nov 21 '05 #1
6 1221
Maybe I haven't been clear enough
My problem is that I don't know how to update the datasource of the
comboboxes in the second column regarding what has been selected in the
comboboxes in the first column of the grid (for the corresponding row)

Nov 21 '05 #2

Catch the CheckedChanged event of the CheckBoxes in the first column.
Get the state of the checkbox (as well all additional data like the
text and tag property if you use them) which raised the event, get the
current selected row in the DataGrid. Then update the datasource using
the row number which you got and the field of the second column with
checkboxes. This is if I understood you question correctly.


1. The user checked a checkbox in the first column.
2. The CheckedChanged event is raised.
3. Get which checkbox raised the event and get the information (like
the name of the tables you mentioned and the checkstate)
4. Get the current selected row.
5. Update the second column with checkboxes.



Nov 21 '05 #3
I'm not using checkboxes... I'm using combobox. But that might be the
same principle, isn't it ?

Nov 21 '05 #4
Actually it might sounds weird, but in fact the only solution in my
opinion is to modify the datasource of the second column according to
what I've been selected in the first one. The problem ist that it might
(and it's not actually) not be the same values at each row in the first
column. Therefore the datasource should be different for every single
rows of the second column. Is that doable ???

Nov 21 '05 #5

It seems I gone crazy! When I red your message, I was seeing checkboxes
not comboboxes, haha! So this is the reason for not understanding your
question before :)
If I understood you correctly you want to select table in the first
column and the fill the second column with the field names of the table
selected in the first one! Is that you are wanting to do?


1. User chooses a table from the combobox.
2. SelectedIndexChanged event is raised.
3. Get the table name from the combo box.
4. Get field names from the table.
5. Fill the second column's combobox with the field names!
6. The user made his/her choice with the second combobox.
7. SelectedIndexChanged event is raised.
8. Get the field name which the user selected.
9. Put into the datasource! Voila!

As I see maybe you do not know how to get which combobox from the first
column and second column is clicked? Right?

Sam, we shall find a solution to your problem, hope my mind is working
now :)


Nov 21 '05 #6
Thanks for this reply.
I have solved my problem yesterday, pretty much the way you've
Hope your brain is getting better, lol ;)


Nov 21 '05 #7

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

Similar topics

by: Jesper Denmark | last post by:
Well I'm new to C# and I do not know of all of the different controls yet. The grid you are referring to is that the datagrid control, and if yes, would it be possible to use it without a database...
by: Aadam | last post by:
Is there a grid that can contain comboboxes, checkboxes, etc. in the columns?
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this...
by: R.A.F. | last post by:
Hi, I would like to know several things about the Grid class from System.Windows.Controls : 1. Can we create new columns types (e.g. columns only with SpinBoxes, or Progressbars, or...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
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...
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...
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...
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 :...
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...
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...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.