how can I set value from textbox suppose if I add value in textbox 17 then it should be considered as 0-17 in datagridview, and then if I add 35 it should be 17-35 in datagridview and suppose after adding two value I am adding third value 25 then it should be 0-17,17-25 and 25-35.
the no. should be between 0 to 100 only and thats I have already done in textbox event. currently I am adding a value directly from text box to datagrid view.
private void AddButton_Click(object sender, EventArgs e) { try { connection = new OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=F:\\Floro_sense\\Floros.mdb"); connection.Open(); // if (FloroValueExists(ValueTextBox.Text)) { MessageBox.Show("The floro Value already exists."); return; } if (FloroTypeExists(TypeTextBox.Text)) { MessageBox.Show("The floro type already exists."); return; } OleDbCommand command = new OleDbCommand("INSERT INTO Sflorotype(Sflorovalues, Sflorotypes) VALUES ('" + ValueTextBox.Text + "','" + TypeTextBox.Text + "');", connection); var result = command.ExecuteNonQuery(); OleDbDataAdapter adapter = new OleDbDataAdapter("select * from Sflorotype", connection); DataTable table = new DataTable(); adapter.Fill(table); var data = string.Join(Environment.NewLine, table.Rows.OfType<DataRow>().Select(x => string.Join(" ; ", x.ItemArray))); BindingSource bind = new BindingSource(); bind.DataSource = table; dataGridViewList.DataSource = bind; adapter.Update(table); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { connection.Close(); } }
private void ValueTextBox_TextChanged(object sender, EventArgs e) { //Add a reference to Microsoft.VisualBasic.dll if (Microsoft.VisualBasic.Information.IsNumeric(this.ValueTextBox.Text)) { int i; int.TryParse(this.ValueTextBox.Text, out i); if (!(i > -1) || !(i < 101)) { this.ValueTextBox.Clear(); } } else { this.ValueTextBox.Clear(); } }
List<MyRangeClass>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)