DataGridView virtual mode row header text

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?
 
J

johneevo

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.
 
L

larrylard

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 :)
 
J

johneevo

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top