Hi everyone!
please tell me -

1) how to make dataGridView cells available to change the values?
2) and how to read the value from cell to a variable?

Thanks for your answers)))

Hi,
1. to make the cell editable - when you are creating dgv, do:

dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgv.MultiSelect = false;

2. read the value from the dgv`s cell in a none dgv`s even or method (some button click for example), but remember, cell has to be selected:

int row = dgv.CurrentCell.RowIndex;
int column = dgv.CurrentCell.ColumnIndex;
if(row > -1)
{
    string cellValue = dgv[column, row].Value.ToString();
    //cellValue now holds the cell current value
}

I hope it helps,
Mitja

The problem is that I load data from a text file))

ddanbe, thanks - I'm reading )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.