DataGridView virtual mode row header text

  • Thread starter Thread starter larrylard
  • Start date Start date
L

larrylard

A simple question, but I can't find the answer anywhere.

What's the 'correct' way of setting the row header text for a
DataGridView in virtual mode?

There is no RowHeaderNeeded event, nor is CellValueNeeded explicitly
called for header cells. At the moment I am setting the value of
headercell.value for the row of every cell that CellValueNeeded is
called for, but this is both inefficient and technically incorrect.
What am I supposed to be doing?
 
A simple question, but I can't find the answer anywhere.

What's the 'correct' way of setting the row header text for a
DataGridView in virtual mode?

There is no RowHeaderNeeded event, nor is CellValueNeeded explicitly
called for header cells. At the moment I am setting the value of
headercell.value for the row of every cell that CellValueNeeded is
called for, but this is both inefficient and technically incorrect.
What am I supposed to be doing?

Not sure if this is the "correct" way, but check out the CellPainting
event. The header row is RowIndex -1.
 
johneevo said:
Not sure if this is the "correct" way, but check out the CellPainting
event. The header row is RowIndex -1.

Thanks johneevo. As it turned out I went for locally cached storage
rather than virtual mode, so I will have to wait for another day to
decide which kludge to use :)
 
Thanks johneevo. As it turned out I went for locally cached storage
rather than virtual mode, so I will have to wait for another day to
decide which kludge to use :)

Hi Larry,

Glad you got things working. Unfortunately I my have lead you down the
wrong path with my suggestion.

I haven't tried virtual mode yet, but don't you still need to add
DataGridViewColumns to the DataGridView to use virtual mode? If so,
then, assuming I understand your requirements correctly, I would think
that the DataGridViewColumn.HeaderText property is what you are looking
for.
 
Back
Top