Reputation: 261
I have one table with 4 columns (id,nameofcase,priceone,pricetwo) in Mysql. I made one dataGridView1 with one column and two columns with button for priceone and pricetwo, and i can see the data. The problem is that, When i pressing one of the two buttons i am getting the information's that i want. How to put those information's in the report?
private void Form3_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'lawyerspriceDataSet.lawsuit_under_500' table. You can move, or remove it, as needed.
this.lawsuit_under_500TableAdapter.Fill(this.lawyerspriceDataSet.lawsuit_under_500);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dataGridView1.Columns["priceoneDataGridViewTextBoxColumn"].Index)
{
//with those 2 lines i am getting the information's that i want
dataGridView1.Rows[row].Cells[col - 1].Value.ToString();
dataGridView1.Rows[row].Cells[col].Value.ToString();
}
else if (e.ColumnIndex == dataGridView1.Columns["pricetwoDataGridViewTextBoxColumn"].Index)
{
dataGridView1.Rows[row].Cells[col - 2].Value.ToString();
dataGridView1.Rows[row].Cells[col].Value.ToString();
}
}
}
private void button1_Click(object sender, EventArgs e)
{
Form4 report = new Form4();
report.Show();
}
Anyone knows how i can do this?
Upvotes: 0
Views: 399
Reputation: 195
try out this:
private void dataGridview_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dataGridview.Columns["btnName"].Index)
{
DataGridViewRow dr=dataGridview.Rows[e.RowIndex];
//do ur stuffs
}
}
Upvotes: 1