| View previous topic :: View next topic |
| Author |
Message |
RoXoY How do I cheat?
Reputation: 0
Joined: 08 Aug 2007 Posts: 0 Location: FBI department
|
Posted: Tue Aug 21, 2007 6:29 am Post subject: VB Express Expec error |
|
|
Hey,
i just began with VB, and im following a tutorial,
right now im making an Slot machine,
but i get an error, and i cant figure out why..
its called Expression Expected,
its located at the '' = ''.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Visible = False
Label1.Text = CStr(Int(Rnd() * 10))
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
If (Label1.Text =Here's the problem ''7'') Or (Label2.Text = ''7'') Or (Label3.Text = ''7'') Then
PictureBox1.Visible = True
End If
End Sub
End Class
I would have posted a Screenshot.. but i can't yet.
Please answer.
Thanks.
_________________
Oh and by the way, my English sucks. |
|
| Back to top |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Tue Aug 21, 2007 7:07 am Post subject: |
|
|
| Never randomize slot machines. Make it so that you always make money.
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Tue Aug 21, 2007 7:20 am Post subject: |
|
|
Comparisons are done with ==, not =.
Should be If (blah == "7")
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
RoXoY How do I cheat?
Reputation: 0
Joined: 08 Aug 2007 Posts: 0 Location: FBI department
|
Posted: Tue Aug 21, 2007 8:06 am Post subject: |
|
|
Wtf.. i just needed to Delete the '' in front and after the number 7, and it worked..
Thanks for reply tho
_________________
Oh and by the way, my English sucks. |
|
| Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Tue Aug 21, 2007 10:22 am Post subject: |
|
|
| nog_lorp wrote: | Comparisons are done with ==, not =.
Should be If (blah == "7") |
But this is VB, designed for someone who have never touched a programming language before and would never know the difference between == and =, or even the meaning of ==. Double equal signs don't exist in VB.
OP, your problem is that you used double single quotes instead of double quotes. Single quotes in VB signifies the start of a single line comment. By deleting the single quotes, you let VB do the work of converting the string into an int, thus you will never know that you can't compare a string to an integer directly.
Lesson: don't learn VB.
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
| Back to top |
|
 |
|