Results 1 to 5 of 5

Thread: getting the type of the control [Resolved]

  1. #1

    Thread Starter
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112

    getting the type of the control [Resolved]

    halu,

    is there any possibility of getting the type of a certain control. let's say a condition of like this...

    VB Code:
    1. if control.type = listview then
    2.     do this
    3. else if control.type = combobox then
    4.     do this

    some sort of an algo, i have here. but can this be done in VB.NET? just a newbie asking question... thanx...
    Last edited by ayan; Feb 3rd, 2004 at 01:33 AM.

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    I'm not sure, but to prevent very large if statements and such, it may be a better idea to create several overloaded functions. Then you can pass whatever you want to it and, as long as you have that as a parameter in 1 of the functions, it'll work.

  3. #3

    Thread Starter
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    thanx... so there's no thing like a built in functions involving the determination of a control type... i'll just make a function of mine...

    thanx man... very much... that's times ten to the power of forever...

    --ayan

  4. #4
    Member
    Join Date
    Dec 2003
    Posts
    43
    Try this.



    VB Code:
    1. Dim ctl as control
    2.       for each ctl in me.controls
    3.             If typeof ctl is Textbox then
    4.                 'do some crap
    5.                    else
    6.                   'do some different crap
    7.                   end if
    8.               next
    Last edited by AFterlife; Feb 3rd, 2004 at 01:32 AM.

  5. #5

    Thread Starter
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    halu,

    thanx... that's great.

    thanx very much AFterlife... a lot...

    i think it's resolved by now.... anywayzzzzzzz, thanx to all of you guys....

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