0

i am a beginner in c # and i have the task of such a project. the first value is column ..this, textbox 1 the second value is row..this, textbox 2 final result..this, textbox 3

DATAGRIDVIEW will not be visible.

DATAGRIDVIEW.VISIBLE = FALSE;

so I can't click on datagridview

how should I do it ? my codes were not functional, thank you very much for the answer. Sorry for my bad english.

enter image description here

not code

Mong Zhu
  • 23,309
  • 10
  • 44
  • 76
11lero11
  • 13
  • 3
  • man, please, show some code... we are not gods to know how it looks – Qhori Jan 27 '20 at 08:43
  • Does this answer your question? [How do I get the cell value from a datagridview using row index and column index in c#?](https://stackoverflow.com/questions/30045468/how-do-i-get-the-cell-value-from-a-datagridview-using-row-index-and-column-index) – Nekeniehl Jan 27 '20 at 08:44

2 Answers2

0

You can use the DataGridViewCell.Value Property to retrieve the value stored in a particular cell. Use something like this in event handler

NameOfDataGridView.SelectedCells[0].Value.ToString();
Qhori
  • 157
  • 12
0

here's my code the selected column does not work, it does not add it to a specific row that is my textbox1, but scrolls to the column and next row. I want for example textbox 1 = 0.3 value from datagridview textbox 2 = 1 value from datagridview textbox 3 is my result anyone have any attacks? thank you for your answers

  for (int c = 0; c < dataGridView1.Rows.Count; c++)
        {
            int x = dataGridView1.CurrentRow.Index;
            int rowindex = dataGridView1.CurrentCell.RowIndex;

            if (dataGridView1.Rows[c].Cells[0].Value.ToString() == textBox1.Text)
            {

                dataGridView1.CurrentCell = dataGridView1.Rows[c].Cells[0];
                dataGridView1.Rows[x].Selected = true;

            }

            if (dataGridView1.Rows[rowindex].Cells[x].Value.ToString() == textBox2.Text)

            {
                dataGridView1.SelectedRows[rowindex].Cells[x].Value.ToString();

            }
            textBox3.Text = dataGridView1.Rows[x].Cells[rowindex].Value.ToString();

        }
11lero11
  • 13
  • 3