I posted a question yesterday for the beginning of this code and I'm not exactly sure what it is I'm doing wrong.
Just a quick summary- I'm trying to make a zodiac calculator, well five of them, but the formatting will be similar, so if I get one right, then the rest should be easy.
But I keep getting the error message
'A just chance exception of type "System.FormatException' occured in mscorlib.dll'
'FormatException was unhandled.' - InputString was not in a correct format.
What other format could I use instead?
Here's what I have:

Sub DayYearTextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDayC.TextChanged, txtYearC.TextChanged
        Dim day As Integer = 1 <= 31
        Dim year As Integer = 1900 <= 2015
        day = Convert.ToInt32(txtDayC.Text)
        year = Convert.ToInt32(txtYearC.Text)
'It hightlights the year as being the error, but I don't know how else to declare it.'
    End Sub

    Sub cboMonthC_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboMonthC.SelectedIndexChanged
        Dim strMonth As String = ""
        strMonth = cboMonthC.Items(0)
        strMonth = cboMonthC.Items(1)
        strMonth = cboMonthC.Items(2)
        strMonth = cboMonthC.Items(3)
        strMonth = cboMonthC.Items(4)
        strMonth = cboMonthC.Items(5)
        strMonth = cboMonthC.Items(6)
        strMonth = cboMonthC.Items(7)
        strMonth = cboMonthC.Items(8)
        strMonth = cboMonthC.Items(9)
        strMonth = cboMonthC.Items(10)
        strMonth = cboMonthC.Items(11)

    End Sub

    Private Sub btnCalC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalC.Click

        If cboMonthC.Items(0) AndAlso txtDayC.Text >= 21 OrElse cboMonthC.Items(1) AndAlso txtDayC.Text <= 17 Then lblOutC.Text = ("Green Dragon.")
        If cboMonthC.Items(1) AndAlso txtDayC.Text >= 18 OrElse cboMonthC.Items(2) AndAlso txtDayC.Text <= 17 Then lblOutC.Text = ("Sea Horse.")
        If cboMonthC.Items(2) AndAlso txtDayC.Text >= 18 OrElse cboMonthC.Items(3) AndAlso txtDayC.Text <= 14 Then lblOutC.Text = ("Hawk.")
        If cboMonthC.Items(3) AndAlso txtDayC.Text >= 15 OrElse cboMonthC.Items(4) AndAlso txtDayC.Text <= 12 Then lblOutC.Text = ("Sea Serpent.")
        If cboMonthC.Items(4) AndAlso txtDayC.Text >= 13 OrElse cboMonthC.Items(5) AndAlso txtDayC.Text <= 9 Then lblOutC.Text = ("Chalice.")
        If cboMonthC.Items(5) AndAlso txtDayC.Text >= 10 OrElse cboMonthC.Items(6) AndAlso txtDayC.Text <= 7 Then lblOutC.Text = ("Golden Wheel.")
        If cboMonthC.Items(6) AndAlso txtDayC.Text >= 8 OrElse cboMonthC.Items(7) AndAlso txtDayC.Text <= 4 Then lblOutC.Text = ("Flaming Spear.")
        If cboMonthC.Items(7) AndAlso txtDayC.Text >= 5 OrElse cboMonthC.Items(8) AndAlso txtDayC.Text <= 1 Then lblOutC.Text = ("Rainbow Salmon.")
        If cboMonthC.Items(8) AndAlso txtDayC.Text >= 2 OrElse cboMonthC.Items(8) AndAlso txtDayC.Text <= 29 Then lblOutC.Text = ("White Swan.")
        If cboMonthC.Items(8) AndAlso txtDayC.Text >= 30 OrElse cboMonthC.Items(9) AndAlso txtDayC.Text <= 27 Then lblOutC.Text = ("Butterfly.")
        If cboMonthC.Items(9) AndAlso txtDayC.Text >= 28 OrElse cboMonthC.Items(10) AndAlso txtDayC.Text <= 24 Then lblOutC.Text = ("White Hound.")
        If cboMonthC.Items(10) AndAlso txtDayC.Text >= 25 OrElse cboMonthC.Items(11) AndAlso txtDayC.Text <= 23 Then lblOutC.Text = ("Raven.")
        If cboMonthC.Items(11) AndAlso txtDayC.Text >= 24 OrElse cboMonthC.Items(0) AndAlso txtDayC.Text <= 21 Then lblOutC.Text = ("White Stag.")


    End Sub
    Sub Output(ByVal day As Integer, ByVal strMonth As String, ByVal year As Integer)

        lblBdayC.Text = "The birthday entered is:"(txtDayC.Text) & (cboMonthC.Items("")) & (txtYearC.Text)
        lblOutC.Text = "Your celtic zodiac sign is:"
    End Sub
    Private Sub linkClearC_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles linkClearC.LinkClicked
        txtDayC.Text = ""
        txtYearC.Text = ""
        lblOutC.Text = ""

    End Sub

I haven't been able to test any of the other things, so I don't know if something else is wrong.

It's probably trying to convert an empty string. Maybe use a tryparse?

Int32.TryParse(txtDayC.Text, day)
        Int32.TryParse(txtYearC.Text, year)

Not sure what you're doing with the "Dim day As Integer = 1 <= 31" lines though...isn't that basically saying "Dim day As Integer = true"?

cboMonthC.Items(""))
The parameter should be an interger value not a string

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.