TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tony
NA
30
0
Where/How to validate fields on Form2
Oct 29 2009 2:59 PM
I am new to C# but have developed an application that worked until the need came up for two additional fields of information (maybe more later). Because of the way the app is structured, I decided to ask for these two fields in a second form (Form2) using a dialog box. This seems to work well and am able to retrieve the two textboxes and include with fields from Form1 to develop a transaction and log entry. However, I have a problem.
I am not sure where I should check that both fields on Form2 have been filled. I have tried checking for blank fields in both forms but although I can generate a message telling the user that both fields are required, I cannot seem to get Form2 to redisplay for the user to fill in the fields. The if/else code continues to the next step which happens to be generating the transaction in Form1. I want it to - if the either field is empty, then display a message and don't leave Form2 until they are filled or the form canceled. Where is the best place to do this check and redisplay the form until the user fills in both fields and hits OK or hits cancel? How do I do it? I have tried various similar ways found in postings using Google and none have worked.
I have similar code in Form1 to check for valid and required fields and it works just fine. Nothing happens until the validations are satisfied. Why not in Form2.
Thanx in advance for any help. This site has been a big help in working through learning C#.
Reply
Answers (
6
)
Autostart application in Vista
dataGrid/datatype display