Hi,
I want to add text to a specific row, column in a DataGridView grid. I have tried several ways to do this bit none seem to work.
Is there a way to do this?
Thanks.
Printable View
Hi,
I want to add text to a specific row, column in a DataGridView grid. I have tried several ways to do this bit none seem to work.
Is there a way to do this?
Thanks.
Use:
Computerman :)Code:datagridview.rows(rownumber).cells(columnnumber).value = text string
or
datagridview.rows(rownumber).cells("column name").value = text string
Hi,
Thanks for your replies.
I tried the following but both ways don't seem to work:-
frmSearch.grdDB.Rows(2).Cells(1).Value = "Test"
frmSearch.grdDB(2, 1).Value = "Test"
I've attached a screenshot showing the error I get.
Thanks.
That's like someone teaching you how to drive and then you saying that it doesn't work if you drive into a wall. Both ways DO work and they are both working, otherwise you wouldn't be getting that error message. In order to get that error message the cell value has to be being set. The problem is that you're setting it to an invalid value. You can't assign the string "Test" to a cell that expects a number, which is what the error message is telling you.
G'day jmcilhinney,
You're right! I've just tried it again and it works.
I'm converting from VB5 to VB.net so it does feel like driving into a wall a times.
Thanks for you response.
Fasten your seat belt and keep your hands inside the vehicle at all times! ;)