VB All Assignment
VB All Assignment
1. Write a code, which display Gender (use If statement) when if you enter F you have to get Female, M male
and other word Unknown.
If TextBox1.Text = "f" Or TextBox1.Text = "F" Then
TextBox2.Text = "Female"
ElseIf TextBox1.Text = "m" Or TextBox1.Text = "M" Then
TextBox2.Text = "Male"
Else
TextBox2.Text = "Unknown
End If
2. Try to change the background color of the button in your form, with writing a Visual Basic.net code and the
kind of color must be Blue.
* select the button
* then go to properties
*then click backcolor
*then choose the color u want!
3. Write visual basic.net code allow users adding two float value together
Dim number1 As Double
Dim number2 As Double
Dim total As Double
number1 = TextBox1.Text
number2 = TextBox2.Text
total = number1 + number2
TextBox3.Text = total
4. Declare a variable store Age of person.
Dim ag As Integer = 20
MsgBox("Your are " + CStr(ag) + " Years Old")
5. Then the output of the program is (example you are 20 years old)
Dim ag As Integer = 20
MsgBox("Your are " + CStr(ag) + " Years Old")
6. Write a program that display Customer Names and their Salary (use Array and for loop) each customer
Name and his/her salary, must be sequential.
Dim cust(5) As String
Dim sal(5) As Integer
cust(0) = "Mustaf"
cust(1) = "SaidAbubakar"
cust(2) = "Khadija"
cust(3) = "Zahra"
cust(4) = "Jibril"
cust(5) = "Aden"
sal(0) = 10000
sal(1) = 20000
sal(2) = 30000
sal(3) = 40000
sal(4) = 50000
sal(5) = 60000
For i = 0 To cust.Length - 1
MsgBox(cust(i))
MsgBox(sal(i))