Age Identifier with Zodiac Sign
Submitted by janobe on Tuesday, April 22, 2014 - 20:09.
Today, I will teach you how to create an age identifier with a zodiac sign included in Visual Basic 2008. I made this for you to be able to identify what is your age with its corresponding zodiac sign. You don’t have to calculate anymore what will be your age in the future and you don’t need to search in the internet what is your zodiac sign if you don’t have any idea what is it. At the same time you will also have fun identifying your friends or love ones age and zodiac sign.
So, let’s get started:
First, you have to open Visual Basic 2008, create a project and do a Form just like this. Name the two DateTimePicker into “DTPDATEBIRTH” and “DTPANDDATE”.
After that, double click the form and do the code above the
Then, go back to the design view, double click the “go” Button and do the following code.
You can download the complete source code. And run it on your computer.
Enjoy……………..
Form_Load
.
- 'DECLARING AN ARRAY VARIABLE TO STORE THE VALUE OF THE ZODIAC SIGNS ON IT.
- Dim zodiac() As String = {"Aries", "Taurus", "Gemini", "Cancer", _
- "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", _
- "Capricorn", "Aquarius", "Pisces"}
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- 'DECLARING A VARIABLE THAT REPRESENTS YOUR AGE.
- Dim age As Integer
- 'DECLARING THE STRING VARIABLE THAT REPRESENTS A FORMATTED DATETIMEPICKER TO THE NAME OF THE MONTHS.
- 'DECLARING THE INTEGER VARIABLE THAT REPRESENTS A FORMATTED DATETIMEPICKER TO THE VALUE OF A DAY.
- 'CALCULATING THE INTERVALS OF THE DATE OF BIRTH AND THE END OF DATE.
- 'CLEARING THE LISTBOX.
- ListBox1.Items.Clear()
- 'ADDING THE VALUE OF THE AGE IN THE LISTBOX.
- ListBox1.Items.Add("Age : " & age).ToString()
- 'CONDITIONING THE MONTHS AND THE DAYS INORDER TO PUT THE SPECIFIC ZODIAC ZIGN.
- Select Case months
- Case "January"
- If days >= 1 And days <= 19 Then
- 'ADDING A ZODIAC SIGN IN THE LIST BOXS.
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(9))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(10))
- End If
- Case "February"
- If days >= 1 And days <= 18 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(10))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(11))
- End If
- Case "March"
- If days >= 21 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(0))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(11))
- End If
- Case "April"
- If days >= 1 And days <= 19 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(0))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(1))
- End If
- Case "May"
- If days >= 1 And days <= 20 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(1))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(2))
- End If
- Case "June"
- If days >= 1 And days <= 21 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(2))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(3))
- End If
- Case "July"
- If days >= 1 And days <= 22 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(3))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(4))
- End If
- Case "August"
- If days >= 1 And days <= 22 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(4))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(5))
- End If
- Case "September"
- If days >= 1 And days <= 22 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(5))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(6))
- End If
- Case "October"
- If days >= 1 And days <= 22 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(6))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(7))
- End If
- Case "November"
- If days >= 1 And days <= 21 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(7))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(8))
- End If
- Case "December"
- If days >= 1 And days <= 21 Then
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(8))
- Else
- ListBox1.Items.Add("Zodiac Sign :" & zodiac(9))
- End If
- End Select
- End Sub
Add new comment
- 1436 views