Dynamically Controlling form controls.

Posted on 2004-11-03
Medium Priority
Last Modified: 2010-04-23
I have all the names of the controls in an DataTable in my application. I need to enable/disable, set textboxes to readonly, set password characters etc from a section of code based on the data in this datatable.
The data will appear the datatable like this:


Can anyone tell me how to do this?

Question by:alfonzocarson
1 Comment

Accepted Solution

eozz_2000 earned 375 total points
ID: 12488142
Well, you can do something like this:

dim ctl as control
dim rows() as datarow
for each ctl in me.controls
  rows = YourTable.Select("[CONTROL_NAME] = '" & ctl.Name & "'")
  if rows.length > 0
    ctl.readonly = rows(0)("Read") 'I suppose that Read = Ture is a read only control
  end if

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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 …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

809 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