0

I am writing a program that will get a user to select their zodiac sign and another persons sign. Once that comes in, I want to use the signs to gauge their compatibility, the result of which falls into 3 categories. I have the program to the point where the user can select both signs and the program can spit them back out to tell the user what they selected (I don't need this message box, I was just doing it to check that my code was working). The part I am having trouble with is making the "compatibility" function and also using the select case, I don't know if I need to declare new variables or if they will work if I made them public. Obviously my code isn't working or I wouldn't be asking for help. For the select case, I just have one so far for Aries but it will need to be done for all 12 signs.

Here is the NEW code:

Public Class Form1

Public Sub btnBegin_Click(sender As Object, e As EventArgs) Handles btnBegin.Click
    lblMySign.Visible = True
    lblYourSign.Visible = True
    cbMySign.Visible = True
    cbYourSign.Visible = True
    btnBegin.Visible = False

    Dim MySign As String
    Dim YourSign As String

    MySign = cbMySign.Text
    YourSign = cbYourSign.Text

    Call Compatibility(Me.cbMySign.Text, Me.cbYourSign.Text)
End Sub

Public Sub cbMySign_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbMySign.SelectedIndexChanged

End Sub

Public Sub cbYourSign_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbYourSign.SelectedIndexChanged
    'Dim MySign As String
    'Dim YourSign As String

    'MySign = cbMySign.Text
    'YourSign = cbYourSign.Text


End Sub
Function Compatibility(cbMySign As String, cbYourSign As String) As String
    Dim strCompat As String

    Select Case cbMySign
        Case "Aries"
            Select Case cbYourSign
                Case "Taurus", "Cancer", "Virgo", "Pisces"
                    strCompat = "NC"
                Case "Gemini", "Libra", "Scorpio", "Capricorn", "Aquarius"
                    strCompat = "N"
                Case "Aries", "Leo", "Sagittarius"
                    strCompat = "C"
            End Select
    End Select

    If strCompat = "NC" Then
        MsgBox("You're not compatible")
    ElseIf strCompat = "N" Then
        MsgBox("You're neutral")
    Else
        MsgBox("You're compatible")
    End If
End Function

End Class

1 Answers1

0

Updated 3:10 PM Sorry about the late reply, need to attend a series of meetings...

I tried to run your whole code, copy-pasted it and run, it works perfectly...

I tried:

My Sign = Aries Your Sign = Virgo

Result: "You're not compatible"

My question is, when you clicked the BtnBegin when will it become visible again?

lblMySign.Visible = True 
lblYourSign.Visible = True 
cbMySign.Visible = True 
cbYourSign.Visible = True 
btnBegin.Visible = False '--- here it is?

I think you need to reset this one upon clicking cbMySign or cbYourSign

-Strider (Yahoo! Answers)