?
Solved

Refering to a controls properties indirectly and using there values?

Posted on 2005-04-06
2
Medium Priority
?
215 Views
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"

msgbox ctl.properties(property)

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.

Thanks!
0
Comment
Question by:majnun
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 13721770
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
0
 

Author Comment

by:majnun
ID: 13727140
Awesome thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

621 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