That's strange..branch_name.items.clear(). Should do d job. On 4/16/11, Steve H <[email protected]> wrote: > That is odd I would have thought the branch_name.SelectedIndex = -1; > would have done what your talking about. > > > On Apr 16, 4:25 am, "Vicky ................." > <[email protected]> wrote: >> Hello everyone, >> >> I m working on c# windows application. I have two combobox for >> >> 1. Bank >> 2. Branch >> >> My question is when i select a bank from bank_name combobox relevent >> branches show in branc_name combobox. >> >> I m using >> >> private void Dispatch_Load(object sender, EventArgs e) >> { >> >> ds = d1.select_bank(); >> bank_name.DataSource = ds.Tables["bank"]; >> bank_name.DisplayMember = "bank_name"; >> >> bank_name.SelectedIndex = -1; >> bank_name.Text = "----Select Bank--------"; >> >> branch_name.DataSource = null; >> branch_name.Items.Clear(); >> >> frm_no.Enabled = false; >> dispatchdate = dispatchDate.Text.ToString(); >> } >> >> private void bank_name_SelectedIndexChanged(object sender, EventArgs e) >> { >> >> branch_name.DataSource = null; >> branch_name.Items.Clear(); >> >> try >> { >> ds1 = d1.select_branch1(bank_name.Text); >> >> branch_name.DataSource = ds1.Tables["branch"]; >> branch_name.DisplayMember = "branch_name"; >> >> branch_name.SelectedIndex = -1; >> branch_name.Text = "------ Select Branch-----"; >> >> } >> catch(Exception ex) >> { >> MessageBox.Show(ex.ToString()); >> } >> >> } >> >> My problem is when i select any item from bank_name combobox in >> branch_name >> combobox previous values are not cleared. >> >> Thanx > > -- > You received this message because you are subscribed to the Google > Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML > Web Services,.NET Remoting" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en > or visit the group website at http://megasolutions.net >
-- You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en or visit the group website at http://megasolutions.net
