Hi!
I' m using the DataGridView on a Windows Form.
I want to return a DataGridView to former state of the display.
How to get the position of the Cell that the top-left on the current DataGridView and how to set the state
The 'top-left' does not means the top-left of 'the data', but 'displayed top-left'.
Thanks.

How to get and set the top-left cell on a DataGridView?
Linda
[-1] was just to ilustrate where I want to be able to write to.
I know it is not valid!
What I am asking is who to write something in the cell that is left of and above [0][0]
the cross of the header row and the header column.
If it can't be done it can't be done!
Kian01
Thank you for your kind answer:
the property is readonly
I had understood it finally, though it slowed.
Your anser is helpfull, and feels good to me.
Thanks a lot.
六子
What if I want to write a static text to the corner itself
In theory this.mydatagridview.Rows[-1].Cells[-1].Value = "hello"
I can write to the rowheader
this.dataGridView1.Rows[0].HeaderCell.Value = "Revenue:";
why not the one above it
Jamel
hi,
as you know when write something like this something[0] it represent array named something, ok when you search for value in an array by useing .indexof() ,if the item was found it return the index if the item wasn't found it return -1 as index, so -1 represent "doesn't exist" in arrays logic,
back to your code when you write something like
this.mydatagridview.Rows[-1].Cells[-1].Value = "hello"
actualy you tell the compiler sellect the "doesn't exist cell" from the "doesn't exist row" and change its value
so the question is how can you write to something that doesn't exist
best regards
TWeiler
Frank ORourke
hi,
i didn't understand what do you mean by your question but you can get the top left cell in your datagrid view through its coordinates something like this
this
.mydatagridview.Rows[0].Cells[0].Value = "hello"and it also have .state but its read only mean you can get it but not to set it
best regards
Hemant Kanoujiya_29
Thank you!
A DataGridView can scrolls up and down.
If you don't scrall down the DataGridView, you can see the top left data in the View.
And if you scroll the DataGridView downward, you can see 'the other cell' in the View.
I want to get and set it.
Please give more advice.
OneEyedJack
hi,
actualy its not a cell , its a row header, you can write in column header but you can't write to row header , rowheader job is to select a row when you press it, or display an icon representing the selected row or other icon during editing any of its cells
to top left cell also has other job , its to select all cells if you click it
Jens Leidel
mmmm when you build any property you can make it readonly or read and write, like your name i can read it but i can't change it the same here
the property is readonly which mean you can read it but you can't set it ,
datagridview is a very complicated control and new as well i don't know anyway to scroll it up and down programaticly but i know how you can select a cell and thats enough for me right now
hope this helps
Ashok_Roy
Sorry!
I coundn't read your important answer:
its read only mean you can get it but not to set it
Thank you.
But I regret this.