Invalid cast in GetEnumerator()

  • Thread starter Thread starter TPS
  • Start date Start date
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;
}
 
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



--
 
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.
 
Back
Top