Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Way to make whole form Read-Only

Status
Not open for further replies.

nerdalert1

Programmer
Nov 4, 2004
92
US
Is there a way without looping through all the controls on a form to make the whole form read only? Thanks all
 
Not that I know of.

Code:
dim ctl as control
for each ctl in me.ctl
  'use reflection to determin object type
  'set readonly/enabled respectively
next

-Rick

----------------------
 
Could you give me an example of the reflection Rick? Thanks
 
Code:
    Dim ctl As Control
    For Each ctl In Me.Controls
      If ctl.GetType.GetMember("ReadOnly").GetUpperBound(0) = 0 Then
        CallByName(ctl, "ReadOnly", CallType.Set, "True")
      ElseIf ctl.GetType.GetMember("Enabled").GetUpperBound(0) = 0 Then
        CallByName(ctl, "enabled", CallType.Set, "False")
      End If
    Next

-Rick

----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top