Results 1 to 3 of 3

Thread: Converting objects from IEnurmerator.Current

  1. #1

    Thread Starter
    Lively Member Ksyrium's Avatar
    Join Date
    Jun 2004
    Location
    Tennessee..yes, we CAN code!!
    Posts
    80

    Converting objects from IEnurmerator.Current

    I have this code:

    Code:
    IEnumerator myEnum = panel1.Controls.GetEnumerator();
    			
    while(myEnum.MoveNext())
    {
    	object o = myEnum.Current;
    	'now convert object to UserControl
    }
    I'm using..

    Code:
    UserControl uc = Convert.ChangeType(o,GetType(UserControl));
    but doesn't work.

    Any ideas??
    You may follow, but not to close!

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    You'll be wanting to cast the object :

    Code:
    IEnumerator myEnum = panel1.Controls.GetEnumerator();
    
    while(myEnum.MoveNext())
    {
        control c = (UserControl) myEnum.Current;
    }

  3. #3

    Thread Starter
    Lively Member Ksyrium's Avatar
    Join Date
    Jun 2004
    Location
    Tennessee..yes, we CAN code!!
    Posts
    80

    Thumbs up [RESOLVED]

    Well now, that was easy wasn't it. I can't believe that slipped by me.

    To many late nights!

    Thanks for the help!!!!
    You may follow, but not to close!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width