-1

Ok, so I'm new to C# Windows App development coming from ColdFusion, PHP, Javascript. I'm picking up on it fairly well I think. I'm understanding the base concepts of OO and how they're implemented in C#, but I'm struggling more with learning how to find what I'm looking for and what's available to me in objects, methods, collections, etc.

For instance. I have a dataview (named "drawing") and I want to filter it using RowFilter, so I do that:

drawing.RowFilter = "partNo = '" + partNo + "'";

As a beginner, how do I know how to access a specific field of data in that dataview now? I finally fumbled around and was able to do it 2 different ways:

drawing[0].Row.ItemArray[0]
  or
drawing[0][0]

My question is this: How do I do less fumbling and more understanding and navigating...essentially PRODUCTIVITY and less guessing!? I've read through Visual C# .NET step-by-step and Apress' Beginning C# OO, but neither of them seem to tell me how to navigate the language like this or gives this detail. That means it's just a matter of getting lucky rather than understanding, which seems like a huge waste of time. I know understanding will come with time and experience, but there's got to be a better method for learning. Either that or there is a gap of fundemental understanding at a foundational level, and if that's the case, what is it?

So how would I know to find the value of a field in a dataview at: "dataview"[index].Row.ItemArray[index]?

I don't see it in the books I have and I can't seem to find it mapped out on the msdn site: http://msdn.microsoft.com/en-us/library/01s96x0z.aspx

Am I just wishful thinking?

Paul
  • 231
  • 4
  • 12
  • Are you using Visual Studio? Does Intellisense not give you the info you need? – Kyle Trauberman Jul 18 '11 at 23:00
  • 1
    Experience and need are the greatest trainers. Secondary are books and looking at other people's code. Keeping active in a forum like this one is helpful. Occasionally there are inspirational threads like this: http://stackoverflow.com/questions/9033/hidden-features-of-c – Chuck Savage Jul 18 '11 at 23:03
  • Yeah I'm using Visual Studio. Intelisense definitely helped, but I think I'm looking more for a reference sheet. Much like the msdn site where it has a table for all methods and properties for a class, it just seems it's not complete or I'm not understanding how to use it properly. – Paul Jul 19 '11 at 03:19

2 Answers2

6

My question is this: How do I do less fumbling and more understanding and navigating...essentially PRODUCTIVITY and less guessing!?

As is the case with any language, you read the documentation

Ed S.
  • 115,705
  • 20
  • 165
  • 244
  • I get that. I mentioned in my post reading 2 books and then I even linked to the MSDN site. For this particular issue I couldn't intuit the syntax for extracting data from the DataView class. How can I derive the syntax for what I have above from this documentation: http://msdn.microsoft.com/en-us/library/system.data.dataview.aspx I don't see a "Row" property or an ItemArray reference. It could be that I don't know how to properly use the documentation. I'd love help with that too if that's the case. – Paul Jul 19 '11 at 03:14
  • @Paul: Well in that case you just need to learn the basics of the language. You would have seen a collection property, and that collection type exposes an operator `[]`, so you know the syntax. You asked about an "object roadmap", not syntax. They are different things. – Ed S. Jul 19 '11 at 03:48
  • That certainly could be the case. I'm definitely new to the language as I mentioned. I've always called myself a "fake programmer" being a web developer for all these years haha. It's probably a stumbling block as much as it is a help. So what are some good resources for filling in that gap of understanding? Any good online documentation? (Im still going over the 2 books I mentioned above as I'm sure I've overlooked things or flat out didn't understand them on first pass. Just trying to be as effective as possible) – Paul Jul 19 '11 at 04:09
  • Let me ask this then...how would I find out/learn (other than using intellisense) that a dataview collection has a .Row property (not sure if that's the correct term) and the .Row property has an ItemArray. Where in the documentation would I find that information? – Paul Jul 19 '11 at 18:43
  • You would look at the docs for DataView, find the Row property, you would see that its type is `Whatever`, you would follow that links, see that it has a collection property, etc. – Ed S. Jul 19 '11 at 18:47
  • Yeah that's what I was thinking and what started this whole post hahaha...I go here: http://msdn.microsoft.com/en-us/library/01s96x0z.aspx and can't find anything about a Row property for the DataView class. So that either means I don't understand how to use the documentation (probable) or it's just not there. Thanks for helping me out! hahaha, not trying to be difficult, just trying to get it through my thick head! – Paul Jul 19 '11 at 18:57
  • Well found what I was looking for...wish u would've been a little less douchey with your original answer. But I get it, it's programming humor...gluck gluck. – Paul Jul 19 '11 at 19:44
  • Douchey? Well, as someone who had previous programming experience I expected you to, you know, know how to use google and read documentation... – Ed S. Jul 19 '11 at 20:06
  • Yeah, well, I guess I don't sugarcoat everything, especially something so obvious. – Ed S. Jul 19 '11 at 21:21
2

Well I finally found what I was looking for!!!!

The The Object Browser in Visual Studio!!

I was able to open the Dataview class and drill down all the way to the ItemArray! It went like this:

DataView *this[int]* which returned a... 
  > DataRowView which had the *Row* property which returns a... 
    > DataRow which finally has the *ItemArray* object!! 

Winner Winner Chicken Dinner!!!

Paul
  • 231
  • 4
  • 12