Hello Ashutosh,
Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.
Actually the comboBox's value list will update automatically if its
DataSource gets changed. In our scenario, we set the dump_docks as the
DataSource. Thus, in order to make the comboBox's value list update, we
firstly need to update the dump_docks table. As you described, this table's
data is filled from the route table by using the select statement "select
distinct dock from route order by dock". So, after we add a new row to the
table route, we need to the following things,
1.Call routeTableAdapter.Update() to commit the added row to the data base.
2.Call dummy_docks.Clear() function to clear all data in the dummy table
3.Use the select command "select distinct dock from route order by dock" to
fill the dummy_docks table again.
The following are codes work fine on my side, please let me know if this
works on your side.
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'testDataSet.lanes'
table. You can move, or remove it, as needed.
this.lanesTableAdapter.Fill(this.testDataSet.lanes);
// TODO: This line of code loads data into the 'testDataSet.route'
table. You can move, or remove it, as needed.
this.routeTableAdapter.Fill(this.testDataSet.route);
this.routeTableAdapter.Adapter.SelectCommand = new
System.Data.SqlClient.SqlCommand("select distinct dock from route order by
dock",new
System.Data.SqlClient.SqlConnection(Properties.Settings.Default.TestConnecti
onString));
this.routeTableAdapter.Adapter.Fill(this.testDataSet.dummy_docks);
this.dataGridViewComboBox1.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox1.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox1.DisplayMember = "dock";
this.dataGridViewComboBox2.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox2.DisplayMember = "dock";
this.dataGridViewComboBox3.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox3.DisplayMember = "dock";
this.dataGridViewComboBox4.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox4.DisplayMember = "dock";
this.dataGridViewComboBox5.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox5.DisplayMember = "dock";
}
private void button1_Click(object sender, EventArgs e)
{
this.testDataSet.route.Rows.Add(new object[] {"r7", 4 });
this.routeTableAdapter.Update(this.testDataSet.route);
this.testDataSet.dummy_docks.Clear();
this.routeTableAdapter.Adapter.SelectCommand = new
System.Data.SqlClient.SqlCommand("select distinct dock from route order by
dock", new
System.Data.SqlClient.SqlConnection(Properties.Settings.Default.TestConnecti
onString));
this.routeTableAdapter.Adapter.Fill(this.testDataSet.dummy_docks);
}
Have a nice day, Ashutosh!
Best regards,
Ji Zhou (
[email protected], remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.