Age Identifier with Zodiac Sign

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”. first form After that, double click the form and do the code above the Form_Load.
  1. 'DECLARING AN ARRAY VARIABLE TO STORE THE VALUE OF THE ZODIAC SIGNS ON IT.
  2.     Dim zodiac() As String = {"Aries", "Taurus", "Gemini", "Cancer", _
  3.                               "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", _
  4.                               "Capricorn", "Aquarius", "Pisces"}
Then, go back to the design view, double click the “go” Button and do the following code.
  1.   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         'DECLARING A VARIABLE THAT REPRESENTS YOUR AGE.
  3.         Dim age As Integer
  4.         'DECLARING THE STRING VARIABLE THAT REPRESENTS A FORMATTED DATETIMEPICKER TO THE NAME OF THE MONTHS.
  5.         Dim months As String = Format(DTPDATEBIRTH.Value, "MMMM")
  6.         'DECLARING THE INTEGER VARIABLE THAT REPRESENTS A FORMATTED  DATETIMEPICKER TO THE VALUE OF A DAY.
  7.         Dim days As Integer = Format(DTPDATEBIRTH.Value, "dd")
  8.  
  9.         'CALCULATING THE INTERVALS OF THE DATE OF BIRTH AND THE END OF DATE.
  10.         age = DateDiff(DateInterval.Year, DTPDATEBIRTH.Value, DTPENDDATE.Value)
  11.         'CLEARING THE LISTBOX.
  12.         ListBox1.Items.Clear()
  13.         'ADDING THE VALUE OF THE AGE IN THE LISTBOX.
  14.         ListBox1.Items.Add("Age : " & age).ToString()
  15.         'CONDITIONING THE MONTHS AND THE DAYS INORDER TO PUT THE SPECIFIC ZODIAC ZIGN.
  16.         Select Case months
  17.             Case "January"
  18.                 If days >= 1 And days <= 19 Then
  19.                     'ADDING A ZODIAC SIGN IN THE LIST BOXS.
  20.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(9))
  21.                 Else
  22.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(10))
  23.                 End If
  24.             Case "February"
  25.                 If days >= 1 And days <= 18 Then
  26.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(10))
  27.                 Else
  28.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(11))
  29.                 End If
  30.             Case "March"
  31.                 If days >= 21 Then
  32.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(0))
  33.                 Else
  34.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(11))
  35.                 End If
  36.             Case "April"
  37.                 If days >= 1 And days <= 19 Then
  38.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(0))
  39.                 Else
  40.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(1))
  41.                 End If
  42.             Case "May"
  43.                 If days >= 1 And days <= 20 Then
  44.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(1))
  45.                 Else
  46.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(2))
  47.                 End If
  48.             Case "June"
  49.                 If days >= 1 And days <= 21 Then
  50.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(2))
  51.                 Else
  52.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(3))
  53.                 End If
  54.             Case "July"
  55.                 If days >= 1 And days <= 22 Then
  56.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(3))
  57.                 Else
  58.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(4))
  59.                 End If
  60.             Case "August"
  61.                 If days >= 1 And days <= 22 Then
  62.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(4))
  63.                 Else
  64.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(5))
  65.                 End If
  66.             Case "September"
  67.                 If days >= 1 And days <= 22 Then
  68.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(5))
  69.                 Else
  70.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(6))
  71.                 End If
  72.             Case "October"
  73.                 If days >= 1 And days <= 22 Then
  74.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(6))
  75.                 Else
  76.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(7))
  77.                 End If
  78.             Case "November"
  79.                 If days >= 1 And days <= 21 Then
  80.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(7))
  81.                 Else
  82.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(8))
  83.                 End If
  84.             Case "December"
  85.                 If days >= 1 And days <= 21 Then
  86.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(8))
  87.                 Else
  88.                     ListBox1.Items.Add("Zodiac Sign :" & zodiac(9))
  89.                 End If
  90.         End Select
  91.  
  92.     End Sub
You can download the complete source code. And run it on your computer. Enjoy……………..

Add new comment