473,396 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

No dataview item property?

Noting first that I'm coming from VS2003 and VB.Net ...

Using an untyped dataset, I create a dataview. When I try to use the Item
property, "Item" does not appear on the Intellisense dropdown and I also get
the build error "'System.Data.DataView' does not containt a definition for
'Item'." The documentation for VS2005 does show Item as a property of a
dataview -- can anyone see the issue?

DataView dvContacts = new DataView(ds.Tables["dtContacts"]);
int intCounter = dvContacts.Count;

for (intCounter = 0; intCounter < -1; intCounter++)
{
intContactID =
System.Convert.ToInt32(dvContacts.Item(intCounter) .Column["ContactID"]);
....
}
Jul 11 '06 #1
5 3909
instead of:
dvContacts.Item(intCounter).Column["ContactID"]);

Try:
dvContacts[intCounter]["ContactID"];

Jul 11 '06 #2
Thanks Steven. That does work. Any reason why the more verbose Item property
shown in the documentation does not work also?

"Steven Nagy" <le*********@hotmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
instead of:
dvContacts.Item(intCounter).Column["ContactID"]);

Try:
dvContacts[intCounter]["ContactID"];

Jul 12 '06 #3
Not 100% sure really.. Does it say that the Item property exists in the
C# syntax?
The default accessor for the collection in VB can use the ITEM
property, but it can also avoid it in the same way C# does (tho with
parenthesis, not square brackets of course).
Not sure what the design reasons for this are... but it just is. No
ITEM property in C#. Remember that and you can't go wrong. :)
Earl wrote:
Thanks Steven. That does work. Any reason why the more verbose Item property
shown in the documentation does not work also?
Jul 12 '06 #4
Yes, it says the Item property exists in C#, but I think I had the syntax
incorrect and I didn't see an example of usage. In any event, if it is
unnecessary, so much the better.


"Steven Nagy" <le*********@hotmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
Not 100% sure really.. Does it say that the Item property exists in the
C# syntax?
The default accessor for the collection in VB can use the ITEM
property, but it can also avoid it in the same way C# does (tho with
parenthesis, not square brackets of course).
Not sure what the design reasons for this are... but it just is. No
ITEM property in C#. Remember that and you can't go wrong. :)
Earl wrote:
>Thanks Steven. That does work. Any reason why the more verbose Item
property
shown in the documentation does not work also?

Jul 12 '06 #5
C# is all about shortcuts. :)
Earl wrote:
Yes, it says the Item property exists in C#, but I think I had the syntax
incorrect and I didn't see an example of usage. In any event, if it is
unnecessary, so much the better.


"Steven Nagy" <le*********@hotmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
Not 100% sure really.. Does it say that the Item property exists in the
C# syntax?
The default accessor for the collection in VB can use the ITEM
property, but it can also avoid it in the same way C# does (tho with
parenthesis, not square brackets of course).
Not sure what the design reasons for this are... but it just is. No
ITEM property in C#. Remember that and you can't go wrong. :)
Earl wrote:
Thanks Steven. That does work. Any reason why the more verbose Item
property
shown in the documentation does not work also?
Jul 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
9
by: Raymond Lewallen | last post by:
I have a dataview in which the sort property will not sort the dataview. Here's is a simple scenario similar to what I am doing: Class Foo Private Function Retrieve() As DataView ' Returns a...
1
by: GeraldBauer | last post by:
I am experiencing some weird behaviors with the listbox and dataview. Here is a boiled down code snippet of what I am trying to do. <snippet> string MENUID = "MenuId" , ITEM = "Item" ,...
0
by: Michał Januszczyk | last post by:
Is it possible somehow to retreive {data Key Value} based on clicked {datagrid item index} ? Now i'm trying to do this in the following way, but with no effect. Now, Instead of getting value...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
4
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.