WinForm and 2005, sorry.
Main Topics
Browse All TopicsI'm trying to simplify my coding by putting all of my requirements in ONE potential line of code instead of assigning if functions to each silly variable i have, which leads me to my question.
I have a UI with text boxes, some of which can be left empty, some which cannot. What I'm looking for is a way to add an array containing those variables that cannot be empty, and if this is possible, for the program to check each variable (text box) for any indication that it's null, if so, throw up a msgbox stating the exact box which is empty before it writes anything to the db.
I'm currently working with a few basic text boxes. FirstName, LastName, DOB, Address, PhoneNumber.
Any help would be greatly appreciated!!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Wow! That was absolutely perfect and more than I even expected. It's almost a perfect solution to my problem.
However just two things, 1 which I can't figure out.
I'm not sure which version you are using but the
Private RequiredEntries() As String = {"LastName", "DOB", "PhoneNumber"}
Had to be
Dim RequiredEntries() As String = {"LastName", "DOB", "PhoneNumber"}
It wasn't happy with the Private at all, it was unusable locally..? Now I understand that we're telling the compiler that the names i've given to the text boxes, which are also my variables, are stated in the initial RequiredEntries.
However, when it comes to returning the result to the MsgBox stating that we've missed a field, it uses the name of our Variable on the MsgBox e.g. FirstName. Because this is the variable and is being contained in ctlName, is there a way that I can change the text to First Name? DOB to Date of Birth etc.
It's extremely complicated for me reading all this at first but i'm slowly grasping the concept.
Thank you for your help!
Business Accounts
Answer for Membership
by: Idle_MindPosted on 2008-10-18 at 15:15:43ID: 22750005
WinForms or WebForms? ...and what version VB.Net?