Hi my name is Cristina I'm a Visual Basic newbie and my non-teaching professor at school virtually just dumped out projects for us to do without teaching anything and just giving out hand-outs.My problem is im having a hard time putting source codes in because its like hard for me to understand but I can get the form correct already. I have two problems:

1.) The user has to input two numbers and then display them and the numbers between them in ascending and descending order depending on what the user clicks on (I already have the option buttons in the frame box) and the user can also choose to display all the numbers, even numbers and odd numbers only ( I also have the option buttons in another frame box).

2.) The user has to give the month and date of their birth and the output is that they would display a picture and name of the zodiac sign corresponding to their birthday. I have already embedded the pictures and the corresponding names my problem is that I'm confused whether I will use the for-next loop or if-then statement or is there anything else I could use for it.I've already done the text boxes where the user can input the month and date of birth but I don't have source codes for it yet :'(

If anybody could show me how to do any of these stuff it would be highly appreciated. Thanks in advance for any help :)

Hi my name is Cristina I'm a Visual Basic newbie and my non-teaching professor at school virtually just dumped out projects for us to do without teaching anything and just giving out hand-outs.My problem is im having a hard time putting source codes in because its like hard for me to understand but I can get the form correct already. I have two problems:

1.) The user has to input two numbers and then display them and the numbers between them in ascending and descending order depending on what the user clicks on (I already have the option buttons in the frame box) and the user can also choose to display all the numbers, even numbers and odd numbers only ( I also have the option buttons in another frame box).

2.) The user has to give the month and date of their birth and the output is that they would display a picture and name of the zodiac sign corresponding to their birthday. I have already embedded the pictures and the corresponding names my problem is that I'm confused whether I will use the for-next loop or if-then statement or is there anything else I could use for it.I've already done the text boxes where the user can input the month and date of birth but I don't have source codes for it yet :'(

If anybody could show me how to do any of these stuff it would be highly appreciated. Thanks in advance for any help :)

a) what level of programming are you taking? If it's advanced or anything but beginners, they the instructor assumes you have the building blocks to either do the project or the resources to find them.

Probably a Loop from Integer i to highest or lowest integer listed would solve this repeating with a next loop until i >= Highest Integer or Lowest

Here since there are a limited amount of Zodiac signs, I would use a Select Case statement and enter Starting date of Zodiac sign and ending date of Zodiac sign and allow the Select Case statements to evaluate the date's with logic

Hope this helps you

I only started with VB6 2 weeks ago. Prior to that my only computer language instruction was about Turbo C :'( I'm not really good or anything I've been trying to figure this out for days on end already but to no avail :'(

If I use a Loop from integer i statement, how do i sort it out if the user predefines it to show only odd or even numbers?Can anybody please show me a syntax how it's done?


If I use select case statement for my Zodiac sign, then how would I sort the months and dates since Zodiac signs overlap in months? (for example Cancer starts in mid-June and ends in mid-July, and Leo immediately follows after). How can I write it in such a way that after checking for the Date and Month, it will come up with the right sign? Another thing, how can I check for illegal Date and Month inputs and how do I loop it back to the Month and Date input screen?

Sorry if I already have too many questions it's just that I've already lost some sleep over this :'( Thanks very much to those who have answered and thanks in advance to those who will help :)

I only started with VB6 2 weeks ago. Prior to that my only computer language instruction was about Turbo C :'( I'm not really good or anything I've been trying to figure this out for days on end already but to no avail :'(

If I use a Loop from integer i statement, how do i sort it out if the user predefines it to show only odd or even numbers?Can anybody please show me a syntax how it's done?


If I use select case statement for my Zodiac sign, then how would I sort the months and dates since Zodiac signs overlap in months? (for example Cancer starts in mid-June and ends in mid-July, and Leo immediately follows after). How can I write it in such a way that after checking for the Date and Month, it will come up with the right sign? Another thing, how can I check for illegal Date and Month inputs and how do I loop it back to the Month and Date input screen?

Sorry if I already have too many questions it's just that I've already lost some sleep over this :'( Thanks very much to those who have answered and thanks in advance to those who will help :)

you can use your incremental in odd or even number to get your values for odd or even, by incrementing your step +1 or + 2 and get the even or odd integers.

If I use select case statement for my Zodiac sign, then how would I sort the months and dates since Zodiac signs overlap in months? (for example Cancer starts in mid-June and ends in mid-July, and Leo immediately follows after). How can I write it in such a way that after checking for the Date and Month, it will come up with the right sign? Another thing, how can I check for illegal Date and Month inputs and how do I loop it back to the Month and Date input screen?

OK, I set up a form with two combo boxes and a button.

The first combobox, cboMonths, is a dropdown list with the collection containing the names of all the months.

The second combobox, cboDays, is a dropdown list that is filled on form_load as follows:

Private Sub zodiac_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim xTemp As Integer
        For xTemp = 1 To 31
            cboDays.Items.Add(xTemp.ToString)
        Next
        cboDays.Enable = False
    End Sub

The above code fills the combobox with numbers 1-31 and then disables the box so it cannot be used. In the form class I define an enumeration of months and a variable:

Private Enum Months
        January = 0
        February = 31
        March = 60
        April = 91
        May = 121
        June = 152
        July = 182
        August = 213
        September = 244
        October = 274
        November = 305
        December = 336
    End Enum

    Private sSign As String

You want to adjust the days based on the months selected, so on the cboMonths_SelectedIndexChanged event we handle enabling the cboDays combobox and adjusting the days in it:

Private Sub cboMonths_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboMonths.SelectedIndexChanged
        cboDays.Enable = True
        Select Case cboMonths.SelectedItem
            Case "January", "March", "May", "July", "August", "October", "December"
                SetDays(31)
            Case "April", "June", "September", "November"
                SetDays(30)
            Case "February"
                SetDays(29)
        End Select
    End Sub

We are calling a SetDays sub to perform the change:

Private Sub SetDays(ByVal piDays As Integer)
        '
        '   Adjust the number of days in the cbodays to match the number passed
        '
        Select Case cboDays.Items.Count
            Case Is < piDays
                '
                '   Add Some Days
                '
                While cboDays.Items.Count < piDays
                    cboDays.Items.Add((cboDays.Items.Count + 1).ToString)
                End While
            Case Is > piDays
                '
                '   Trim Some Days
                '
                While cboDays.Items.Count > piDays
                    cboDays.Items.Remove((cboDays.Items.Count).ToString)
                End While
        End Select
    End Sub

When they press the button, show them their sign:

Private Sub BtnSign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSign.Click
        Dim sMonth As String = cboMonths.SelectedItem
        Dim eMonth As Months = CType([Enum].Parse(GetType(Months), sMonth, True), Months)
        Dim Bday As Integer = eMonth + CType(cboDays.SelectedItem, Integer)

        If Bday >= (Months.January + 20) And Bday <= (Months.February + 18) Then
            '
            '   Aquarius Jan 20-Feb 18
            '
            sSign = "Aquarius"
            MessageBox.Show(sSign)
            Exit Sub
        End If
        If (Bday >= Months.February + 19) And (Bday <= (Months.March + 20)) Then
            '
            '   Pisces Feb 19 - Mar 20
            '
            sSign = "Pisces"
            MessageBox.Show(sSign)
            Exit Sub
        End If
        '
        '   Etc. etc. etc.
        '
    End Sub

You could do this without the sSign and just pop the MessageBox, but I figure you will build a routine to use the sSign to post a picture, etc. Hope this helps and is not too confusing. The tricky part is:

Dim sMonth As String = cboMonths.SelectedItem
        Dim eMonth As Months = CType([Enum].Parse(GetType(Months), sMonth, True), Months)
        Dim Bday As Integer = eMonth + CType(cboDays.SelectedItem, Integer)

This code turns the "Name" of a month, back into the Enum "Number" of the month (or rather number of days in the year prior to the start of this month) and then adds the days into that month to get the number of days into the year that the bDay (birthday) represents.

I would use the built in DateTimePicker Control so that you don't have to check for valid dates. Then the whole thing is as easy as:

Public Class frmSign

    Private Sub btnGetSign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetSign.Click
        Dim mmdd As String

        mmdd = Month(dtpDOB.Value) & DateAndTime.Day(dtpDOB.Value)

        Select Case mmdd
            Case "101" To "119"
                MsgBox("You are a Capricorn", , )
            Case "120" To "219"
                MsgBox("You are an Aquarius", , )
            Case "220" To "320"
                MsgBox("You are a Pisces", , )
            Case "321" To "420"
                MsgBox("You are an Aries", , )
            Case "421" To "521"
                MsgBox("You are a Taurus", , )
            Case "522" To "622"
                MsgBox("You are a Gemini", , )
            Case "623" To "723"
                MsgBox("You are a Cancer", , )
            Case "724" To "823"
                MsgBox("You are a Leo", , )
            Case "824" To "923"
                MsgBox("You are a Virgo")
            Case "924" To "1023"
                MsgBox("You are a Libra", , )
            Case "1024" To "1122"
                MsgBox("You are a Scorpio", , )
            Case "1123" To "1222"
                MsgBox("You are a Sagittarius")
            Case "1223" To "1231"
                MsgBox("You are a Capricorn", , )


        End Select
    End Sub
End Class

But you would always have to force the year on the control to a leap year, which would look strange. She only cares about month and the day.

This article has been dead for over six months. Start a new discussion instead.