473,387 Members | 1,942 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,387 software developers and data experts.

<Cannot view indexed property>


Hi,

I have created a collection of a custom class. Everything works fine (can add these items in a combo from within a VB.NET application, for instance), but when looking at the collection from a VB.NET application in the Watch window, I cannot see the items of the collection. The message in the Watch window's "value" says: "<cannot view indexed property>." Below is the code I wrote.

Any idea of what is wrong? Or is the error message "correct"?

Thanks a lot.
Mike


public class Companies : IEnumerable {

ArrayList m_oCompanies = null;

public Companies() { // Nothing is done in the constructor. }
public void Add(Company oCompany) {...}
public Company this[int index] {
get { return (Company)m_oCompanies[index]; }
}

public int Count { ... }

}

public IEnumerator GetEnumerator() { return new CompaniesEnumerator(m_oCompanies); }

// Inner class implements IEnumerator interface:
class CompaniesEnumerator : IEnumerator {

int index;
ArrayList m_oCompanies;

public CompaniesEnumerator(ArrayList oCompanies) { this.m_oCompanies = oCompanies; }

public bool MoveNext() { return (++index < m_oCompanies.Count); }

public object Current {
get {
if (index < m_oCompanies.Count) return m_oCompanies[index];
else
return null; }
}

public void Reset() { ... }
Nov 15 '05 #1
1 1812
This is an issue with the debugger.
"Mike" <no****@hotmail.com> wrote in message news:OA**************@TK2MSFTNGP12.phx.gbl...

Hi,

I have created a collection of a custom class. Everything works fine (can add these items in a combo from within a VB.NET application, for instance), but when looking at the collection from a VB.NET application in the Watch window, I cannot see the items of the collection. The message in the Watch window's "value" says: "<cannot view indexed property>." Below is the code I wrote.

Any idea of what is wrong? Or is the error message "correct"?

Thanks a lot.
Mike


public class Companies : IEnumerable {

ArrayList m_oCompanies = null;

public Companies() { // Nothing is done in the constructor. }
public void Add(Company oCompany) {...}
public Company this[int index] {
get { return (Company)m_oCompanies[index]; }
}

public int Count { ... }

}

public IEnumerator GetEnumerator() { return new CompaniesEnumerator(m_oCompanies); }

// Inner class implements IEnumerator interface:
class CompaniesEnumerator : IEnumerator {

int index;
ArrayList m_oCompanies;

public CompaniesEnumerator(ArrayList oCompanies) { this.m_oCompanies = oCompanies; }

public bool MoveNext() { return (++index < m_oCompanies.Count); }

public object Current {
get {
if (index < m_oCompanies.Count) return m_oCompanies[index];
else
return null; }
}

public void Reset() { ... }
Nov 15 '05 #2

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

Similar topics

3
by: Hadar | last post by:
Hi, I'm trying to dynamically set the src of an iframe with the <% %> block: <iframe id="content" src="<% = Request.QueryString.Get("content") %>" width="100%"></iframe> Notice that the tag...
1
by: Ed West | last post by:
Am getting this error with the following code, particularly this line: <%# Check(DataBinder.Eval(Container.DataItem, "broker_id"))%> I am creating checkboxes and the Check function checks to...
1
by: Mike | last post by:
Hi, I have created a collection of a custom class. Everything works fine (can add these items in a combo from within a VB.NET application, for instance), but when looking at the collection from a...
1
by: Bill Johnson | last post by:
In vb6 I could quickly go to any given property while in the properties window by holding the CTRL + SHIFT keys down plus the first letter of the property I want to edit. For example, if I wanted...
2
by: Jofio | last post by:
I have 3 files, namely: dArray.h dArray.cp TestdArray.cpp Problem is when I compile the 'main' program - TestdArray.cpp - , it (the compiller) produces the following error: 'Unable to open...
3
by: lm Jr | last post by:
<cc:SourceWindow id="SourceWindow1" FileName="<%=Request.ServerVariables%>" RunAt="server" > The above produces the following error: Server tags cannot contain <% ... %constructs. Any idea,...
0
by: Debajit Adhikary | last post by:
I'm writing a SAX parser using Python and need to parse XML with entity references. <tag>&lt;&gt;</tag> Only the last entity reference gets parsed. Why are startEntity() and endEntity() never...
3
by: AleXmanFree | last post by:
Hi , I have got problem with passing my inline based value to y user control (or custom control, no matter which one I use, I have tried both to make sure it doesnt matter) . So say I have...
2
by: kwokv616 | last post by:
I'm writing some very simple codes that i'm quite sure are correct (at least i can't find out what is wrong with it =P) I'm trying to run the following: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.