This code defines the behavior of buttons and menu items on a form. Button1 and the Hello menu item set the label text to "Hello", Button2 and Goodbye menu item set it to "Goodbye", and Button3 and Exit menu item close the form. Each button and menu item trigger a subroutine to perform the designated action when clicked.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
73 views
Exercise 6
This code defines the behavior of buttons and menu items on a form. Button1 and the Hello menu item set the label text to "Hello", Button2 and Goodbye menu item set it to "Goodbye", and Button3 and Exit menu item close the form. Each button and menu item trigger a subroutine to perform the designated action when clicked.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click Label1.Text = "Hello!" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Label1.Text = "Goodbye!" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Close() End Sub Private Sub HelloToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelloToolStripMenuItem.Click Label1.Text = "Hello!" End Sub Private Sub GoodbyeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoodbyeToolStripMenuItem.Click Label1.Text = "Goodbye!" End Sub Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Close() End Sub End Class