- Left click on the object that you want to rename. (Button)
- Select the property that you want to change (Name)
- Left click on name and then type in the new name of your object (btnpushme)
- You have now declared btnpushme
This blog is created to enhance the learning experience of IT students at Elangeni College Pinetown Campus
Monday, 13 June 2011
Naming An Object in VB.Net - Button
Adding Text to An Object- Button
- Left click on the object that you want to change the text off. (Button)
- Select the property that you want to change (Text)
- Left click on text and then type in the new text of your object (Push Me)
Adding two numbers with Variables
Adding Two Numbers with Variables
Write a program that asks the user to enter in two numbers and then to add them and show the answer. You are required to draw the IPO as well as the user interface and write the code for this program,using variables to determine your answer.
IPO Framework
Input | Process | Output |
Enter first number (num1) | | |
Enter second number (num2) | ||
| Add first number (num1) to the second number (num2) | |
| | The sum of both numbers (answers) |
User Interface
Public Class frmaddnums
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, sum As Integer
num1 = Val(txtnum1.Text)
num2 = Val(txtnum2.Text)
sum = num1 + num2
lblans.Text = sum
End Sub
End Class
Adding two numbers without Variables
Adding Two Numbers without Variables
Write a program that asks the user to enter in two numbers and then to add them and show the answer. You are required to draw the IPO as well as the user interface and write the code for this program, not using variables to determine your answer.
IPO Framework
Input | Process | Output |
Enter first number (num1) | | |
Enter second number (num2) | ||
| Add first number (num1) to the second number (num2) | |
| | The sum of both numbers (answers) |
User Interface
Coding
Public Class frmaddnums
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
lblans.Text = Val(txtnum1.Text) + Val(txtnum2.Text)
End Sub
End Class
Subscribe to:
Posts (Atom)