473,387 Members | 3,033 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,387 software developers and data experts.

Populate DataGridComboBox dynamically as per value in first column

Hi,

I need urgent help on Windows Form datagrid. I have to Display a datagrid
that has a textbox column and another one combo box column. I have two tables
in my Access database as:
Table 1:
Columns: Part_ID, Descr
Here Part_ID is Primary key.

Table 2:
Columns: Part_ID, Part_Functions
Here Part_ID refers to column of table above.

Now I need to enter "Descr" value in first textbox column and as per the
corresponding "Part_ID", I need to populate the ComboBox with
"Part_Functions" in second column.

i.e. the Values populated in ComboBox should be correspond to the Part_ID
for that row only. The purpose behind this is that user enters a Description
of Part in first column, from which we can get "Part_MID". Now for second
column, the dropdown should be populated only with values that map to that
Part_MID in Table 2.

This is Windows Form DataGrid not Web Based Datagrid.

Please help me to solve this out.
Will appreciate a quick help,

TIA
SA.

Sep 28 '05 #1
1 2696
Digit
4
Check this site :
http://msdn.microsoft.com/msdnmag/is...ds/?print=true

The only thing that bothers me with this option is that u sort what is in the data and not what u c :(
What I mean is when you have 2 codes in your rows :
Code 1 : representing "ZZZ"
Code 2 : representing "AAA"
Then u 'll c in the column "ZZZ" and "AAA" but when u sort this column he will put "ZZZ" before "AAA" because he'll sort the codes behind the representations (1 and 2).
Have no sollution for this except creating an extra column which actually contains strings (or ints,....) and show this column.

Once you create the comboboxcolumn class, you can use it something like this :
DataGridComboBoxColumn MyComboColumnStyle;
MyComboColumnStyle = new TestComboColumn();
MyComboColumnStyle.HeaderText="Type";
MyComboColumnStyle.MappingName="TypeVerrichting";
MyComboColumnStyle.ComboBox.DataSource=dtHistTypes ;
MyComboColumnStyle.ComboBox.DisplayMember="Omschri jvingTaal1";
MyComboColumnStyle.ComboBox.ValueMember="Code";
MyDataGridTableStyleProductHistory.GridColumnStyle s.Add(MyComboColumnStyle);
dataGridProductHistory.PreferredRowHeight=MyComboC olumnStyle.ComboBox.Height+1;

Don't mind the strange names in it like "OmschrijvingTaal1", I'm dutch and I don't want to change all the names :D

Hope this helps :)
Sep 28 '05 #2

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

Similar topics

2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
0
by: Swadh | last post by:
Hi, I need urgent help on Windows Form datagrid. I have to Display a datagrid that has a textbox column and another one combo box column. I have two tables in my Access database as: Table 1:...
4
by: sydney.luu | last post by:
Hello, I would greatly appreciate if someone can show me how to dynamically build a Repeater with unknown number of columns at design time. I have looked various threads in this newsgroup,...
1
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
0
by: vijendra | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file?I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
1
by: freekedoutfish | last post by:
Hi. New member here Im sat at work, pounding my head off the desk because this tiny bit of simple code refuses to work. The sub is intended to pull data from the "companyname" column in the...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
1
by: =?Utf-8?B?UGF0cmljayBG?= | last post by:
I have a gridview on the page that i want to dynamically populate with radiobuttons, so i went out on the net and found something that works perfectly, it created radionuttons and the postback with...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.