Results 1 to 4 of 4

Thread: How to refer to a control using a function

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    1

    Question How to refer to a control using a function

    I want to refer to use a function for referring to a control something like this:

    functionname("cmdbutton1").height=32

    this should set the height of the command button named "cmdbutton1" to 32. Does anyone know how to do this?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I think you are going to have to explain what it is you are trying to do a little better. You want to function to return a control if you pass in the name? Are you talking about on the same form?

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    you can say

    public functionname(mycontrol As Button, Height as integer) as blah

    but you cant give functions properties...
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Although something like this may work:

    functionname(controlname as string) as control

    Which then you could use the .height after it to work with the control it returned without another variable, but its kind of ugly.

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