Forms

FORMS

1. Pulling Results from a Dialog form

A very common problem with forms is getting the result of a dialog form.  Dialogs are used to ask a question or to get a response.  If it’s a simple question with a Yes/No or OK answer, then the standard dialog form is quick and easy to create, and simple to use.  But if the user must enter some value or select from an option, getting the information from the form requires extra code.

2. Passing Data to a New Form

For a Windows Forms application, creating a new form is as easy as Project / Add Windows Form / Windows Form.  But what if you need to set this form up with some data that exists in the main form?   How do you populate the controls and variables in the new form with the existing values from the main form?

3. Where did I come from?

Passing values between forms is one of the trickiest bits of a multi form application for new VB .Net programmers, but that’s partly because there are so many ways to handle it.  When a form needs to know where it came from, there is a property of the form that can provide just that information, if it’s set up properly.

4. Pushing Results Back to the Main Form

Even if you identify the form that opened a subsidiary form, it’s not always easy to update controls on the form with new values.  This snippet shows how it is done.

5. Messaging Between Forms

Messaging between forms is the most robust way of passing data back and forth between forms. It allows you to create forms that can be re-used with a minimum of issues about how you connect data on different forms.


  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s