Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Adding buttons in relation to a specific row

$
0
0

I've trying to add two button to the rows that have value 2, but these button appear only in relation to the dataGridView.

If I don't give them a specific location they will appear at the top of the dataGridView, and when I give them a specific location they will still appear in relation to the dataGridView.

How can I make them appear in relation to each row that has value 2?

I want to make the buttons appear at the bottom or inside that specific row. I've been looking for an answer for a long time and I can't find anything.

Button buttonOk =newButton(){Width=100,Height=50};Button buttonCancel =newButton(){Width=100,Height=50};publicvoid method1(DataGridView dataGridView1){foreach(DataGridViewRow row in dataGridView1.Rows){if((string)row.Cells[2].Value==("1")){
                row.DefaultCellStyle.ForeColor=Color.Green;}elseif((string)row.Cells[2].Value==("2")){
                row.DefaultCellStyle.ForeColor=Color.Blue;
                dataGridView1.Controls.Add(buttonOk);
                dataGridView1.Controls.Add(buttonCancel);//buttonOk.Location = new Point(00, 74);}elseif((string)row.Cells[2].Value==("3")){//do something}}}



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>