How do I set the value of an unbound DataGridView cell?
I need to build a Form with a DataGridView. I do not intend to use this grid to connect to any database. I simply need to know how to write some string or value (whatever) to a specific cell.
I have spent hours fooling with this (VS 2005 SE) and searching the Internet without any luck. I could waste alot of time and space posting code that doesnt work and the associated error messages, but I think I will spare you that for now.
If anyone can help me accomplish this task, I would greatly appreciate it.
Thanks
Mike :wave:
[569 byte] By [
Mike Pliam] at [2007-11-20 11:49:31]

# 1 Re: How do I set the value of an unbound DataGridView cell?
You do it exactly as you've asked the question: you get the cell and you set its Value property. You can get a reference to the cell via the grid's Item property or any number of other ways. It sounds to me like you've spent hours fooling around and searching the Internet without spending a minute doing the thing you should have done first of all: reading the documentation for the DataGridView class. The MSDN library has plenty of reference and howto information on the DataGridView, including some dedicated to unbound grids, in which case you have to explicitly add columns and rows before any cells exist.
# 2 Re: How do I set the value of an unbound DataGridView cell?
Thanks. You have such a pleasant way of putting things.
I'll do as you suggest and won't ask about it again.
FWIW, my article was a C# article. Sorry if I used this forum "inappropriately".
Mike :(
# 3 Re: How do I set the value of an unbound DataGridView cell?
I'm all about the information, not the presentation. :)