0% found this document useful (0 votes)
4 views

Basic Operators and Variable in Visual Basic

The document outlines the creation of a calculator form in Visual Basic, detailing the use of variables, operators, and helper methods for functionality. It includes instructions for button actions, input retrieval, and data passing to another form. Additionally, it specifies how to display inputted details in the second form using public properties.

Uploaded by

Joshua Camarillo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Basic Operators and Variable in Visual Basic

The document outlines the creation of a calculator form in Visual Basic, detailing the use of variables, operators, and helper methods for functionality. It includes instructions for button actions, input retrieval, and data passing to another form. Additionally, it specifies how to display inputted details in the second form using public properties.

Uploaded by

Joshua Camarillo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Basic Operators and Variable in Visual Basic

Method helpers
Goal
• Create a calculator form
• Code and declare variables, operators used
and method helper
• Run code
• ButtonClicked – triggers button to perform its tasks
• GetInput - Helper method to retrieve and convert input from textboxes to
integer
• .Clear()- method helpers that clear the txtbox.

Challenge
• Each button must function according to is functionality
• Use GetInput method to retrieve integer from textbox
• Tryparse Integer helper to convert string representation of a number to its
32-bit signed integer equivalent.
Sample Code

‘Add more for the other buttons’

‘This is the end class’


Passing Value using Get

• fullName – Textbox
• Gender – RadioButton
• Hobbies- Checkbox ()
• Nationality – ComboBox()
• Skills-CheckList()
• Bio(RichText)
• ProfilePicture(PictureBox)
• Address(ListBox)
• Age- NumericUpDown
• Favorate BrowserWeb
• Birthday: Date Picker
How to pass the value?
Provide the necessary details
in the form
Declare variables as you submit the button

Dim f2 As New Form2()//method to instantiate form2

' Set public properties to pass values


f2.NameValue = Name
f2.AgeValue = Age
f2.NationalityValue = Nationality
f2.SkillsValue = Skills
f2.HobbiesValue = Hobbies
f2.AddressValue = Address
f2.CountryValue = Country
f2.LanguageValue = Language
f2.GenderValue = Gender
f2.BioValue = Bio
Dispay Form in Form2 the inputted details
• Public Property NameValue As String
• Public Property AgeValue As String
• Public Property NationalityValue As String
• Public Property SkillsValue As String
• Public Property HobbiesValue As String
• Public Property AddressValue As String

• Public Property CountryValue As String Private Sub Form2_Load(sender As Object, e As EventArgs) Handles
• Public Property LanguageValue As String MyBase.Load
• Public Property GenderValue As String
' Display the passed values in labels
lblName.Text = "Name: " & NameValue
• Public Property BioValue As String lblAge.Text = "Age: " & AgeValue
lblNationality.Text = "Nationality: " & NationalityValue
lblSkills.Text = "Skills: " & SkillsValue
lblHobbies.Text = "Hobbies: " & HobbiesValue
lblAddress.Text = "Address: " & AddressValue
lblCountry.Text = "Country: " & CountryValue
lblLanguage.Text = "Language: " & LanguageValue
lblGender.Text = "Gender: " & GenderValue
lblBio.Text = "Bio: " & BioValue

End Sub

You might also like