Hello,
I have a big problem in my project please help me.. :(
In my form1 datagridview all columns have checkbox.I have a button when user click button I want to transfer which selected row/rows how can I solve this problem?
My problem is to transfer data by multiple selection.For example, users makes multiple selection with checkboxes in the table and that you have selected the rows in the DataGrid will show in another form Datagrid in WindowsForms.So I used this code to transfer data from another form's datagrid.I succeed it transfer 1 row with this code but I didn't multiple transfer data.This is my code of transfer data.
Int32 ID = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[1].Value.ToString());
MessageBox.Show("ID" + ID);
DataTable table = new DataTable();
using (SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Dorana.mdf;Integrated Security=True;User Instance=True;Pooling=False")) {
string SQL = @"Select * from booking Where ( bookingID = @bookingID);";
SqlCommand cmd = new SqlCommand(SQL, conn);
cmd.Parameters.AddWithValue("@bookingD", ID);
conn.Open();
table.Load(cmd.ExecuteReader());
conn.Close();
}
booking rezerve= new booking();
// DataGridView dgv1 = new DataGridView { Dock = DockStyle.Fill };
rezerve.Controls.Add(dataGridView1);
rezerve.dataGridView1.DataSource = table;
rezerve.Show();
rezerve.dataGridView1.Columns["name"].HeaderText = "Name";
rezerve.dataGridView1.Columns["surname"].HeaderText = "Surname";
rezerve.dataGridView1.Columns["gender"].HeaderText = "Gender";
rezerve.dataGridView1.Columns["date"].HeaderText = "Date";
And this picture is my booking screenshoot
bora