Invalid cast in GetEnumerator()

T

TPS

I am trying to bind a listbox to my custom collection object.

My object implements IEnumerable and crashes when the bind event calls
myobject.GetEnumerator()

I get an Invalid Cast exception in this method:

Here is the class def.:
public class CSLAHeaderCOL : IEnumerable, ICollection


Here is the method that crashes:
public IEnumerator GetEnumerator()
{
return IEnumerator = (IEnumerator)this;
}
 
T

TPS

I figured it out.

This worked in version 1.0, but looks like the have tightened it up in 2003

I needed to implement IEnumerator as well

public class CSLAHeaderCOL : IEnumerable, ICollection

public class CSLAHeaderCOL : IEnumerable, ICollection, IEnumerator



--
 
M

MS News \(MS ILM\)

You can dynamically disable form elements via:
document.FORMNAME.ELEMENTNAME.disabled=true;
or

If you want it literally greyed out, you can use CSS to apply a style to the
parts you want changed.

Make a style that sets the areas you want changed to one scheme (white
background, font etc etc) Then when whatever event happens to grey those
areas out, you can change the style attributes and make it a grey background
or some similar effect.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top