I am a student new to VB
I am currently in the second year of my degree
I have encoutered VB before but on my first attempt I failed the module
Currently there is no lecturer willing to take on VB full time
and the part time teachers are too busy to take us seriously, however as a result of
of my first failure I have too resit VB I am willing but I do not completely unders tand the syntax.

Currently the project i signed up for is a currency converter that would exis as a user control in the control pannel, and a graph that would allow the user to view fluctuation history.
but my code refuses to run.
I used combo boxes to hold string values (e.g.United States, Spain, Trinidad and Tobago)
for both Convert From and Convert To fields.
A button click as the event that would drive the control.

MY BUTTON REFUSES TO WORK
I HAVE BEEN SITTING HERE FOR A WEEK AND NO IMPROVEMENT
WHAT DO I DO
CAN ANY ONE HELP ME!!!!!

Hi,
Can you show us the code?

Relax dude!

Post the code here, we will try and figure out the problem.

Hi,
Can you show us the code?

Some of my code in this section is unfinished I made several changes
trying to fix my "hidden" errors

The only button on my control that is working is the "Me.Dispose"
one.

Private Sub btnRequest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRequest.Click
[B]' Declarations[/B]

        Dim January As Date
        Dim Feburary As Date
        Dim March As Date
        Dim April As Date
        Dim May As Date
        Dim June As Date
        Dim July As Date
        Dim August As Date
'
        cmbMonth.Text = January
        cmbMonth.Text = Feburary
        cmbMonth.Text = March
        cmbMonth.Text = April
        cmbMonth.Text = May
        cmbMonth.Text = June
        cmbMonth.Text = July
        cmbMonth.Text = August

        Dim Eastern As String
        Eastern = cmbConvertFrom.Text
        Dim Caribbean As String
        Caribbean = cmbConvertFrom.Text
        Dim Spain As String
        Spain = cmbConvertFrom.Text
        Dim Trinidad As String
        Trinidad = cmbConvertFrom.Text
        Dim Tobago As String
        Tobago = cmbConvertFrom.Text

'Validation code, If user chooses the same ctring values for "ConvertFrom and Convert To combo boxes"

        If cmbConvertFrom.Text = Trinidad And Tobago And cmbConvertTo.Text = Trinidad And Tobago Then
            MessageBox.Show ("Please ensure that countries are different.",_"My Application", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) = DialogResult.OK

        End If

        If cmbConvertFrom.Text = Spain And cmbConvertTo.Text = Spain Then
            lblError1.Text = ("Please ensure that countries are different")
        Else
        End If

[B]'Declaring and assigning values to my Array[/B]
        Dim USagainstTT(6) As String

        USagainstTT(0) = "6.05"
        USagainstTT(1) = "6.10"
        USagainstTT(2) = "6.15"
        USagainstTT(3) = "6.20"
        USagainstTT(4) = "6.25"
        USagainstTT(5) = "6.30"

        Dim ECagainstTT(6) As String
        ECagainstTT(0) = "2.26"
        ECagainstTT(1) = "2.28"
        ECagainstTT(2) = "2.30"
        ECagainstTT(3) = "2.32"
        ECagainstTT(4) = "2.34"
        ECagainstTT(5) = "2.36"

"Requesting the rates of conversion assigned to arrays

        If cmbMonth.Text = January Then
            lblRate.Text = USagainstTT(4)
        Else
        End If
        If cmbMonth.Text = Feburary Then
            lblRate.Text = USagainstTT(4)
        Else
        End If

        If cmbMonth.Text = March Then
            lblRate.Text = USagainstTT(4)
        Else
        End If

        If cmbMonth.Text = April Then
            lblRate.Text = USagainstTT(4)
        Else
        End If

        If cmbMonth.Text = May Then
            lblRate.Text = USagainstTT(4)
        Else
        End If
        If cmbMonth.Text = June Then
            lblRate.Text = USagainstTT(4)
        Else
        End If

        If cmbMonth.Text = July Then
            lblRate.Text = USagainstTT(4)

            If cmbMonth.Text = August Then
                lblRate.Text = USagainstTT(4)
            Else
            End If
        End If

        
    End Sub

thank you very much!!!!!!!!!!!!!

Well, I see syntax errors in your code.
When you compare the text in the ComboBox you must put "Trinidad and Tobago" enclosed with "

MessageBox.Show ("Please ensure that countries are different.", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) = DialogResult.OK

You cannot assign a value (DialogResult.OK) to the MessageBox function. Beeing a function, it returns a value, which maybe DialogResult.OK.

To add items in the ComboBox cmbMonth, you must use something like this:

cmbMonth.Items.Add(January)
cmbMonth.Items.Add(February)
' etc...

You cannot compare a String variable (cmbMonth.Text) with a Date variable (January, February, etc.) like you are doing here:

If cmbMonth.Text = January Then
    lblRate.Text = USagainstTT(4)
Else
End If

I think you must code something like this:

With cmbMonth
                .Items.Add("January")
                .Items.Add("February")
                ' etc...
        End With

        ' ...

        If cmbMonth.Text = "January" Then
                lblRate.Text = USagainstTT(4)
        End If

        ' etc...

Hope it helps

Thank you martin...so so so much...!!!

Hi,
Is your problem solved?

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.