I already responded to that and told you that I mistakenly told you to use
Item, when it should be Cells.
But, this really brings up a larger point. When you type:
dataGridName.Rows(1) and then the dot (.), you will get a list of possible
choices that could be added at that point. If you don't understand that
what you *can* add at that point must be on the list you see, then you
should back way up and start learning about object-oriented programming from
the beginning.
Please don't think I'm trying to be rude, because I'm not, but there are so
many times when even a seasoned VB .NET developer is going to come up
against an object they've never worked with before. But understanding the
basics allows us to deduce what we need by letting Visual Studio help us.
In other words, the message you got about Item not being a member of Rows
should tell you loud and clear that you can't use Item with Rows, but on the
other hand what was on the drop-down list after you typed the period? A
quick examination of that list should reveal some good possiblie choices.
If you are still unclear what to choose, you could very easily go into the
help on the Rows keyword and see what it says there.
-Scott
As someone who has gone through this and has taught countless others VB
.NET, I stand by my statment. But, I may need to explain it a bit further.
When you come to VB .NET from VB and you make assumptions about what
"should" work, you will most likely not be taking the correct route. So my
advice is forget what you know and come into VB .NET fresh and willing to
learn from scratch.
As you then learn (or relearn) VB .NET, you will find certain language
elements that haven't changes (decision making code and loops come to
mind).
And, you'll then feel good about your prior knowledge in that particular
area.
But to assume that all the language elements work as they used to is
incorrect. For example, declaraing an Integer is still done the same way
in
VB .NET, but now, you'll get a 32 bit integer, rather than the 16 bit one
you got in VB 6. Now, if you declare a variable (exactly the same way you
used to in VB 6) inside a coding block (If...Then, etc.), you'll get block
level scope, which didn't exist before.
No, I said what I meant. In order to not get burned, it's best to start
from scratch and not assume anything. If you encounter something along the
way that still is the way you learned it before, that's just a bonus.
-Scott
- Show quoted text -
I would just like to know how to make VB 2008 Express work. As I said
in an earlier post, the suggested way of accessing one cell via
"dataGridName.Rows(1).Item(2) "
does not work; it resultrs in an error message;
"item is not a member of System.Windows.Forms.DataGridViewRow"
I'm sure there's something else I'm doing wrong and would greatly
appreciate any help figuring out what it is.
Thanks,
Bob