Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27374

VS 2010 Adding an item to a List with checking

$
0
0
Here is my situation:

I have a GUI form that has many textboxes on it. At the bottom of the GUI form, there is an OK and a Cancel button. When the OK button is pressed, the Textbox controls are checked against certain criteria. E.g. The LocationName Textbox is checked to see if the .Text property is filled in as well as the LocationOwner TextBox.

What is the best way to do this?

Currently, in the OK button OnClick() event, I have a Boolean variable at the top that is set to True. At each line in the code, where the controls are checked against certain criteria, the Boolean variable is set to False if any of the criteria fails. At the bottom, if the Boolean variable is True, the List is populated with a new item with all the details from the controls on the form. If it False, the List is not populated with a new item and the user needs to make sure that all the criteria does not fail before a new item can be added to the list.

The process above works, I am just wondering if there is an 'Official' way to do this process?

Viewing all articles
Browse latest Browse all 27374

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>