Visual Basic Hello World Project PDF
Document Details
Uploaded by ImprovingHeliotrope7180
Tags
Summary
This document demonstrates the basic design and syntax for creating a Hello World project in Microsoft Visual Basic. It showcases visual elements like forms, buttons, and labels, along with the corresponding code snippets. The document covers how to use Visual Basic to design graphical user interfaces (GUIs) and implement user actions.
Full Transcript
Basic Design and Syntax for Microsoft Visual Basic Hello World Project Design and Syntax Properties Label1: Name: messagelabel Show Button: Name: bt...
Basic Design and Syntax for Microsoft Visual Basic Hello World Project Design and Syntax Properties Label1: Name: messagelabel Show Button: Name: btnShow Text: Show Exit Button: Name: btnExit Text: Exit By clicking the Show button, “Hello World!” text should be displayed in Label1. By clicking the Exit button, the program should stop from running. Syntax for Hello World Project Public Class Form1 Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click Me.messagelabel.Text = "Hello World!" End Sub End Class ---------------------------------------------------------------- Sample 1 Project Design and Syntax (Form1, Form2 and Form3) Form 1 Properties Label1: Name: lblFirstName Label2: Name: lblLastName Grade-Section: Name: lblGradeSection Text: Grade-Section Click Me! Button: Name: btnClick Text: Show Reset Button: Name: btnClear Text: Reset Close Button: Name: btnClose Text: Close By clicking the Click Me! button, text on Label1, Label2 and Grade- Section should be displayed and equivalent to the designated texts on the coding list. **Check syntax below By clicking the Reset button, texts for Label1, Label2 and Grade-Section will be replaced with its first state in running the program. By clicking the Close button, the program should stop from running. Form1 Syntax Public Class Form1 Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click lblFirstName.Text = "Ann Jen" lblLastName.Text = "Muli" lblGradeSection.Text = "Grade 10-St. Luke" End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click lblFirstName.Text = "Label 1" lblLastName.Text = "Label 2" lblGradeSection.Text = "Grade-Section" End Sub End Class Form 2 Properties Textbox1: Name: txtFullName Textbox2: Name: txtGradeSection Textbox3: Name: txtAdviser Next Button: Name: btnClick Text: &Next Clear Button: Name: btnClear Text: &Clear Close Button: Name: btnClose Text: C&lose By clicking the Clear button, all texts inputted in the textboxes should be deleted. **Form should go back to its first state. By clicking the Close button, the program should stop from running. By clicking the Next button, the program is set to display Form1 and hide Form2. Form2 Syntax Public Class Form2 Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click txtFullName.Clear() txtGradeSection.Clear() txtAdviser.Clear() End Sub Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click Form1.Show() Me.Hide() End Sub End Class