Stumbleupon Facebook Twitter Digg Google Delicious Linkedin
TechNews

Obtain the object of a given control its name.

Posted: 27 Jan 2012

Tags: Obtain the object of a given control its name Obtain the object given control its name


Question:

Based on code Andreas Killer previously provided to obtain the object of a given name of code (here), worksheet I wrote the following function to obtain the object of a given control name:

Function GetControlObject public (ByVal ControlName As String) as Control

Answer:

I've tested this and it works very well. MyControl does not return Null - what you see is that its value is returned as "". Try to put a text in the text box. For example, the value of "TextBox1 text", and you should see returned as the value in the place.

If you set a watch variable MyControl, you will see that it is not nothing, which indicates that a real object is returned.

HTH,

Eric

Rate this article:


  • Pages:
  • 1

0 Comments

Add Your Comment !