473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

complex grid with comboboxes

Sam
Hi,
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 ?
Thx

Nov 21 '05 #1
6 1242
Sam
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
Sam,

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.

Example:

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.

Regards,

Philip.

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

Nov 21 '05 #4
Sam
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
Sam,

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?

Then:

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 :)

Philip.

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

Sam

Nov 21 '05 #7

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

Similar topics

0
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...
2
by: Aadam | last post by:
Is there a grid that can contain comboboxes, checkboxes, etc. in the columns?
1
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...
4
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.