Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 156
  • Last Modified:

Calling Control property using Variable

Is it possible to call control properties using variable.

Say, I have a Menu control. Name is "New".
I declared on variable ("strControl") and assigning the value "New" to that string variable.
Now i am using ...> strControl.enabled=false .
It is not working for me. Is there a way i can achive these kind of requirement.
Please help me in this.
0
VijayK
Asked:
VijayK
1 Solution
 
cmgarnettCommented:
Select Case strControl
Case "New"
   mnuNew.Enabled = False
Case "Old"
  mnuOld.Enabled = False
End Select
0
 
TimCotteeCommented:
Hi VijayK,

Open questions:
03/31/03 http:Q_20568661.html "Calling Control property using Variable"
03/17/03 http:Q_20553244.html "Passing Parameter value to ActiveXViewer"
03/06/03 http:Q_20541932.html "DataBase connection with Crystal Reports"
03/06/03 http:Q_20540607.html "ORA-12638 : Credential retrieval failed"
01/16/03 http:Q_20460241.html "Impact on compiling prodecure without table."
01/13/03 http:Q_20455117.html "ActiveX control stops IIS"
12/18/02 http:Q_20430621.html "How to send parameter to Crystal Reports"
12/13/02 http:Q_20425304.html "How window.screenTop   differs from mach..."
12/03/02 http:Q_20414229.html "Restricting multiple user login with same loginId"

Please close your open questions. Failure to maintain your questions is in contravention to the user agreement and you may be penalised or have your account suspended if you fail to do so.

Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
 
VijayKAuthor Commented:
Hi,

   See i have around 60 menus. I don't want to hard code in my code and don't want to loop so many times.
Menu name comes from DataBase with ID. I am going to Loop thru the Recordset and enabling/disabling the menu.
Is it possible??

Thanks.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
iozturkCommented:
There is no other way to do it:) Just enable and disable them.
0
 
TimCotteeCommented:
It is possible:

Use

CallByName Me.Controls(strControl),"Enabled",True,vbLet
0
 
VijayKAuthor Commented:
Hi TimCottee..

Thanks a lot. Excelent.

0
 
TimCotteeCommented:
VijayK

Thanks for also cleaning up your outstanding questions.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now