problem with multicolumncombo and bindingnavigator movenext ,...
-
hi i am use 4 multicolumncombi in my form in first navigatorbinding is correct but when one record insert in database my moveprevious and next previous is not show correct tytle in multicolumncombobox and when close program and run program again bindingnavigator is correct but when save again not show tytle correct my source code: [php] private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { moshtarakinhoghoghiBindingSource.AddNew(); if (phonebookDataSet.moshtarakin_hoghoghi.Compute("max(SysCode)+1", null).ToString() != null) editBox1.Text = phonebookDataSet.moshtarakin_hoghoghi.Compute("max(SysCode)+1", null).ToString(); else editBox1.Text = 1.ToString(); editBox3.Text = ""; editBox2.Text = ""; editBox4.Text = ""; multiColumnCombo1.Text = ""; multiColumnCombo2.Text = ""; multiColumnCombo3.Text = ""; multiColumnCombo4.Text = ""; uiComboBox1.Text = ""; } [/php] [php] private void multiColumnCombo1_TextChanged(object sender, EventArgs e) { if (multiColumnCombo1.Text != "") stateCityBindingSource.Filter = "State_Id='" + Convert.ToInt32(multiColumnCombo1.Value.ToString()) + "'"; } private void multiColumnCombo3_TextChanged(object sender, EventArgs e) { if (multiColumnCombo3.Text != "") activityBindingSource.Filter = "code_groh='" + Convert.ToInt32(multiColumnCombo3.Value.ToString()) + "'"; } private void toolStripButton1_Click(object sender, EventArgs e) { try { moshtarakinhoghoghiBindingSource.EndEdit(); moshtarakin_hoghoghiTableAdapter.Update(this.phonebookDataSet.moshtarakin_hoghoghi); } catch { } } [/php] . please help me . best regards
-
hi i am use 4 multicolumncombi in my form in first navigatorbinding is correct but when one record insert in database my moveprevious and next previous is not show correct tytle in multicolumncombobox and when close program and run program again bindingnavigator is correct but when save again not show tytle correct my source code: [php] private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { moshtarakinhoghoghiBindingSource.AddNew(); if (phonebookDataSet.moshtarakin_hoghoghi.Compute("max(SysCode)+1", null).ToString() != null) editBox1.Text = phonebookDataSet.moshtarakin_hoghoghi.Compute("max(SysCode)+1", null).ToString(); else editBox1.Text = 1.ToString(); editBox3.Text = ""; editBox2.Text = ""; editBox4.Text = ""; multiColumnCombo1.Text = ""; multiColumnCombo2.Text = ""; multiColumnCombo3.Text = ""; multiColumnCombo4.Text = ""; uiComboBox1.Text = ""; } [/php] [php] private void multiColumnCombo1_TextChanged(object sender, EventArgs e) { if (multiColumnCombo1.Text != "") stateCityBindingSource.Filter = "State_Id='" + Convert.ToInt32(multiColumnCombo1.Value.ToString()) + "'"; } private void multiColumnCombo3_TextChanged(object sender, EventArgs e) { if (multiColumnCombo3.Text != "") activityBindingSource.Filter = "code_groh='" + Convert.ToInt32(multiColumnCombo3.Value.ToString()) + "'"; } private void toolStripButton1_Click(object sender, EventArgs e) { try { moshtarakinhoghoghiBindingSource.EndEdit(); moshtarakin_hoghoghiTableAdapter.Update(this.phonebookDataSet.moshtarakin_hoghoghi); } catch { } } [/php] . please help me . best regards
my problem resolved my code: [php] private void Form2_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'phonebookDataSet.moshtarakin_hoghoghi' table. You can move, or remove it, as needed. this.moshtarakin_hoghoghiTableAdapter.Fill(this.phonebookDataSet.moshtarakin_hoghoghi); SqlConnection ConSub = new SqlConnection("Data Source=.;Initial Catalog=phonebook;Integrated Security=True"); ConSub.Open(); SqlDataAdapter Adapter = new SqlDataAdapter("Select * from State", ConSub); DataTable State = new DataTable(); Adapter.Fill(State); multiColumnCombo1.DataSource = State; Adapter.SelectCommand.Connection = ConSub; Adapter.SelectCommand.CommandText = "Select * from StateCity where State_Id='" + Convert.ToInt32(multiColumnCombo1.Value.ToString()) + "'"; DataTable StateCity = new DataTable(); Adapter.Fill(StateCity); multiColumnCombo2.DataSource = StateCity; Adapter.SelectCommand.Connection = ConSub; Adapter.SelectCommand.CommandText = "Select * from groh"; DataTable groh = new DataTable(); Adapter.Fill(groh); multiColumnCombo3.DataSource = groh; Adapter.SelectCommand.Connection = ConSub; Adapter.SelectCommand.CommandText = "Select * from activity where code_groh='" + Convert.ToInt32(multiColumnCombo3.Value.ToString()) + "'"; DataTable activity = new DataTable(); Adapter.Fill(activity); multiColumnCombo4.DataSource = activity; } private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { moshtarakinhoghoghiBindingSource.AddNew(); if (phonebookDataSet.moshtarakin_hoghoghi.Compute("max(SysCode)+1", null).ToString() != null) editBox1.Text = phonebookDataSet.moshtarakin_hoghoghi.Compute("max(SysCode)+1", null).ToString(); else editBox1.Text = 1.ToString(); editBox3.Text = ""; editBox2.Text = ""; editBox4.Text = ""; multiColumnCombo1.Text = ""; multiColumnCombo2.Text = ""; multiColumnCombo3.Text = ""; multiColumnCombo4.Text = ""; uiComboBox1.Text = ""; } private void multiColumnCombo1_TextChanged(object sender, EventArgs e) {