473,587 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<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_oCom panies[index]; }
}

public int Count { ... }

}

public IEnumerator GetEnumerator() { return new CompaniesEnumer ator(m_oCompani es); }

// Inner class implements IEnumerator interface:
class CompaniesEnumer ator : IEnumerator {

int index;
ArrayList m_oCompanies;

public CompaniesEnumer ator(ArrayList oCompanies) { this.m_oCompani es = oCompanies; }

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

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

public void Reset() { ... }
Nov 20 '05 #1
1 3369
Mike,

The watch window cannot view properties that have an indexer. If you need to
see the contents of an indexed property, specify the index as part of the
watch.

e.g.

m_oCompanies.It em(0)

You'll get an exception if the index you specify is out of range.

On a side note, I didn't know you could compile C# code with VB.net ;) (your
source is c#, but your post refers to VB)

HTH,

Trev.
"Mike" <no****@hotmail .com> wrote in message
news:Ou******** ******@TK2MSFTN GP10.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_oCom panies[index]; }
}
public int Count { ... }
}
public IEnumerator GetEnumerator() { return new
CompaniesEnumer ator(m_oCompani es); }
// Inner class implements IEnumerator interface:
class CompaniesEnumer ator : IEnumerator {
int index;
ArrayList m_oCompanies;
public CompaniesEnumer ator(ArrayList oCompanies) { this.m_oCompani es =
oCompanies; }
public bool MoveNext() { return (++index < m_oCompanies.Co unt); }
public object Current {
get {
if (index < m_oCompanies.Co unt) return m_oCompanies[index];
else
return null; }
}
public void Reset() { ... }
Nov 20 '05 #2

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

Similar topics

1
1823
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 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...
3
17738
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 (intentionally) has no runat=server and also nested in a <TD> tag... What am I doing wrong?
1
2628
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 have that particular checkbox checked by default. I am not using checkboxlist because I want to EASILY save data to DB with a comma separated list...
1
1853
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 to change the caption property of a form, I would press CTRL + SHIFT + P and i would immediately go to the caption property. Is there such a short...
2
4283
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 include file 'dArray.h' 'Unable to open include file'dArray.cp'
3
4688
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, what to do here? I am an old ASP programmer. Thanks for help !
0
1111
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 called? I'm using the following code: http://pastie.textmate.org/62610
3
1678
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 property called ImagePath and i want to pass my value through asp.net specific inline cunstruction: <uc:MyControl runat=server id="someId" ImagePath="<%=...
2
5470
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: ------------------------------------------------------------------------------------------------------------- Private Sub CSV_Click() Call CSV(Forms!..Value)
0
7920
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8215
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6626
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.