Refering to a controls properties indirectly and using there values?

Posted on 2005-04-06
Last Modified: 2010-04-23
I would like very much to be able to do something like this:

dim ctl as control

ctl = myTextBox

dim propery as string

property = "text"


Is this possible?

I don't want to do this:
ctype(ctl, TextBox).text

I need everything to be flexible so I can dynamically set what property i want of any kind of control.

Question by:majnun
    LVL 85

    Accepted Solution

    Like this?....

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim ctl As Control
            ctl = TextBox1

            Dim strProperty As String
            strProperty = "Text"

            CallByName(ctl, strProperty, CallType.Let, "Hello World")
            MsgBox(CallByName(ctl, strProperty, CallType.Get))
        End Sub

    Author Comment

    Awesome thanks!

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now