1. Home
  2. Computing & Technology
  3. Visual Basic

A Two Form Example Program
Main Form Code

By , About.com Guide

Jul 18 2008

Public Class InpectionScheduleForm
   Private Sub SelectNewInspecDate_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles SelectNewInspecDate.Click
      SelectNewInspectDate.ShowDialog()
      InspectDateDisplay.Text = _
         SelectNewInspectDate.InspectDate.ToString("MMMM dd, yyyy")
      FreqChanged(sender, e)
   End Sub

   Private Sub FreqChanged( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles FreqMonthly.CheckedChanged, _
         FreqBiMonthly.CheckedChanged
      Select Case True
         Case FreqMonthly.Checked
            NextInspectDate.Text = _
               DateAdd(DateInterval.Month, 1, _
               SelectNewInspectDate.InspectDate). _
               ToString("MMMM dd, yyyy")
         Case FreqBiMonthly.Checked
            NextInspectDate.Text = _
               DateAdd(DateInterval.Month, 2, _
               SelectNewInspectDate.InspectDate). _
               ToString("MMMM dd, yyyy")
      End Select
   End Sub
End Class

Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Using VB.NET
  5. A Two Form Example Program

©2009 About.com, a part of The New York Times Company.

All rights reserved.