| | |
Life and Death
![]() |
•
•
Join Date: Jul 2008
Posts: 5
Reputation:
Solved Threads: 0
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!!!!!
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!!!!!
Relax dude!
Post the code here, we will try and figure out the problem.
Post the code here, we will try and figure out the problem.
My blog on .NET- http://dotnet.tekyt.info
•
•
Join Date: Jul 2008
Posts: 5
Reputation:
Solved Threads: 0
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.
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 ' Declarations 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 'Declaring and assigning values to my Array 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
Last edited by Tekmaven; Jul 21st, 2008 at 2:32 pm. Reason: Code tags
Well, I see syntax errors in your code.
When you compare the text in the ComboBox you must put "Trinidad and Tobago" enclosed with "
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:
You cannot compare a String variable (cmbMonth.Text) with a Date variable (January, February, etc.) like you are doing here:
I think you must code something like this:
Hope it helps
When you compare the text in the ComboBox you must put "Trinidad and Tobago" enclosed with "
VBNET Syntax (Toggle Plain Text)
MessageBox.Show ("Please ensure that countries are different.", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) = DialogResult.OK
To add items in the ComboBox cmbMonth, you must use something like this:
VBNET Syntax (Toggle Plain Text)
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:
VBNET Syntax (Toggle Plain Text)
If cmbMonth.Text = January Then lblRate.Text = USagainstTT(4) Else End If
I think you must code something like this:
VBNET Syntax (Toggle Plain Text)
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
-- Martín
![]() |
Similar Threads
- 3 word story (Posting Games)
- Windows vs. Linux (IT Professionals' Lounge)
- Jokes n stuff - Post em here... (Geeks' Lounge)
- C++ is dying a slow death (C++)
- What about the 6800 Ultra (Monitors, Displays and Video Cards)
- Help on assignment (C)
- Philosophies on Theology? (Geeks' Lounge)
- blue screen of death (Windows NT / 2000 / XP)
- LCD display has a broad white band (Monitors, Displays and Video Cards)
Other Threads in the VB.NET Forum
- Previous Thread: cannot save data to access using vb.net2003 form
- Next Thread: Delete From String array
Views: 649 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access ado.net application array arrays basic bindingsource browser build button buttons c# center checkbox client code combobox connection control convert crystal crystalreport data database datagrid datagridview dataset date datetimepicker design designer dissertation dissertations embedded error excel file form gridview image images insert listview login loops mobile ms msaccess net objects openxml path port print printing problem read save search security serial server settings shutdown sms socket sorting sql statement studio syntax tagging tags textbox time timer type update upload user validation vb vb.net vb2008 vbnet view visual visualbasic visualstudio2008 vs2008 web webbrowser webrequest windows wpf xml





