All controls on a form to read-only?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Close

    #1

    All controls on a form to read-only?

    How does one make all controls on a Windows form read-only? Controls such as
    check boxes, combo boxes and date time pickers dont appear to have a
    read-only property. Disabling the controls makes them hard to read and you
    cant select/copy the contents of text boxes.

    Thanks


  • Herfried K. Wagner [MVP]

    #2
    Re: All controls on a form to read-only?

    "Paul Close" <support@comput erdoctor.com.au > schrieb:[color=blue]
    > How does one make all controls on a Windows form read-only? Controls such
    > as check boxes, combo boxes and date time pickers dont appear to have a
    > read-only property. Disabling the controls makes them hard to read and you
    > cant select/copy the contents of text boxes.[/color]

    I doubt that this is possible without using replacements for some of the
    controls. You'll find some replacements for common controls which support a
    read-only mode. The article
    <URL:http://www.codeproject .com/cs/miscctrl/ReadOnlyComboBo x.asp> showcases
    a read-only combobox control, for example. In addition to using replacement
    controls you can selectively set controls to read-only mode or disable them
    based on their type. To do that, recursively enumerate the controls on the
    form and check their type using 'TypeOf...Is... '.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: All controls on a form to read-only?

      Addendum:
      [color=blue]
      > <URL:http://www.codeproject .com/cs/miscctrl/ReadOnlyComboBo x.asp>[/color]

      <URL:http://www.codeproject .com/useritems/CompleteReadOnl yComboBox.asp>

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      • Paul Close

        #4
        Re: All controls on a form to read-only?

        Thanks. Good info.

        "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
        news:%23qmRi$8u FHA.3452@TK2MSF TNGP14.phx.gbl. ..[color=blue]
        > Addendum:
        >[color=green]
        >> <URL:http://www.codeproject .com/cs/miscctrl/ReadOnlyComboBo x.asp>[/color]
        >
        > <URL:http://www.codeproject .com/useritems/CompleteReadOnl yComboBox.asp>
        >
        > --
        > M S Herfried K. Wagner
        > M V P <URL:http://dotnet.mvps.org/>
        > V B <URL:http://classicvb.org/petition/>[/color]


        Comment

        Working...