Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 183875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:11:35+00:00 2026-05-11T15:11:35+00:00

I need to implement input validation throughout my winform app. There are many different

  • 0

I need to implement input validation throughout my winform app. There are many different forms where data can be entered and I would like to not go control by control by form and create isValid etc per item. How have others dealt with this?

I see that most related posts deal with Web Apps and/or mention Enterprise Library Validation Application Block. Now I admit I haven’t thoroughly researched ELVAB but it seems like overkill for what I need. My current thought is to write a class library with the various requirements and pass it a control as a parameter. I already have a Library of RegEx functions for things like isValidZipCode and such so that may be a place for me to start.

What I would like to have is a Validate button that onClick cycles through all the controls on that Form Page and performs the needed validation. How can I accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:11:36+00:00Added an answer on May 11, 2026 at 3:11 pm

    In my own application I need to validate dimensions as they are typed in. The sequence I used is as follows

    1. The user selects or types then moves away from the control.
    2. The control loses focus and notifies the View sending it’s ID and the entry text.
    3. The View checks what Shape Program (a class implementing a interface) created the Form and passes it the ID and entry text
    4. The Shape Program returns a response.
    5. If the Response is OK the View updates correct Entry of the Shape Class.
    6. If the Response is OK the View tells the Form through a Interface that it is OK to shift the focus to the next entry.
    7. If the Response is not OK, the View looks at the response and using the Form Interface tells the form what to do. This usually means the focus shifts back to the offending entry with a message displayed telling the user what happened.

    The advantage of this approach that validation is centralized in one location for a given Shape Program. I don’t have to go modify each control or even really worry about the different types of controls on the form. Way back when I designed the software I decided how the UI going to work for textboxes, listboxes, combo boxes, etc. Also different levels of severity is handled differently.

    The View takes care of that instructing the Form what to do through the Interface. How it actually is implemented is handled by the Form itself in it’s implementation of the Interface. The View doesn’t care if the Form is displaying yellow for warning and red for error. Only that it handles those two levels. Later if a better idea of displaying warning vs errors comes along I can make the change in the Form itself rather mucking around with the View logic or the validate in Shape Program.

    You are already halfway there if you are considering making a class to hold your validation logic this will get you the rest of the way in your new design.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 169k
  • Answers 169k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Prefix it with '/Views' should help. return View("~/Views/Items/Details.aspx"); May 12, 2026 at 1:51 pm
  • Editorial Team
    Editorial Team added an answer I would say if you are going to do the… May 12, 2026 at 1:51 pm
  • Editorial Team
    Editorial Team added an answer Bind it to ActualWidth of LeftMenuWrapper: <StackPanel> <DockPanel LastChildFill="True" Height="100"… May 12, 2026 at 1:51 pm

Related Questions

I've tried looking everywhere for a concise list of the advantages and disadvantages of
I have a mostly desktop programming background. In my spare time I dabble in
I've got the common situation where I've got user input that uses a subset
We use a base entity with properties such as version (datetime needed for NHibernate)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.