Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. User Control function C#

User Control function C#

Scheduled Pinned Locked Moved C#
helpcsharpquestion
24 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Ralf Meier

    Some time ago I created an application with a similar behaviour (normally I create HMI-applications for machines). I found that the users sometimes entered senseless data into a Textbox. So I created (with the TextChanged-Event) a method to those Textboxes which data has a special format (for example : it must have a legal date or an Integer value or a Phone-number or ...) and give a User-message (MessageBox) to correct this. In the same time I disable the Save-Button. Perhaps this approach helps you ...

    I Offline
    I Offline
    Ismael_1999
    wrote on last edited by
    #21

    I tried your suggestion some time ago. It worked fine, but I could not prevent the buttons to change their enable status. That’s why I’m trying something different.
    I continue accepting suggestions and thanks.

    R 1 Reply Last reply
    0
    • I Ismael_1999

      I tried your suggestion some time ago. It worked fine, but I could not prevent the buttons to change their enable status. That’s why I’m trying something different.
      I continue accepting suggestions and thanks.

      R Offline
      R Offline
      Ralf Meier
      wrote on last edited by
      #22

      Why don't you can disable the Button ? Please explain ...

      I 1 Reply Last reply
      0
      • R Ralf Meier

        Why don't you can disable the Button ? Please explain ...

        I Offline
        I Offline
        Ismael_1999
        wrote on last edited by
        #23

        Enable and disable the buttons depend on which buttons was pressed. When the user enters the screen, the Save and Cancel buttons are disabled. The other 3 are enabled. When user presses New or Edit buttons, the enable state changes. It's programmed in the User Control, which is generic.

        R 1 Reply Last reply
        0
        • I Ismael_1999

          Enable and disable the buttons depend on which buttons was pressed. When the user enters the screen, the Save and Cancel buttons are disabled. The other 3 are enabled. When user presses New or Edit buttons, the enable state changes. It's programmed in the User Control, which is generic.

          R Offline
          R Offline
          Ralf Meier
          wrote on last edited by
          #24

          There is no contradiction betwenn my suggestion and your realisation ... If your UserControl has one (or more) Property, which gives this further information to it (for example "the entered data is not valid") you can add all the behaviour you want to have. If you want to work with an UserControl for those functionality it only depends on the "interface" to the rest of the application.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups