1. Computing & Technology

Discuss in my forum

A Two Form Example Program

Main Form Code

By , About.com Guide

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

©2012 About.com. All rights reserved.

A part of The New York Times Company.