Richman Posted April 12, 2005 Posted April 12, 2005 Hiya i recently took the plunge into vb i have bought myself vb.net (standard) 2003 edition along with Visual Basic.net for Dummies. I was going throught the book and came to a task where the author wanted me to make a programme that had diffrent smiley faces which when clicked displayed messages. This is the code i have used Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picSmile.Click System.Object, ByVal e As System.EventArgs)_ Handels(picSmile.Click) picSmile.BorderStyle =_ System.Windows.Forms.BorderStyle.FixedSingle() picFrown.BorderStyle =_ System.Windows.Forms.BorderStyle.None() picHappy.BorderStyle =_ System.Windows.Forms.BorderStyle.None() lblMessage.Text = "Hello, world!" End Sub When i write this into vb is displays as shown below with all blue lines under it why is this. http://img.photobucket.com/albums/v406/Richman/vb.jpg Thankyou Rich Quote
Administrators PlausiblyDamp Posted April 12, 2005 Administrators Posted April 12, 2005 Remove the () from the end of None and FixedSingle - that should remove some of the errors. 'Handles' is not spelt 'Handels' - that should remove another error; also the (picSmile.Click) doesn't need the brackets around it. If any others remain what is the error message displayed either in the Task List or by the tooltip if you put your mouse over the wavy blue line? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
IngisKahn Posted April 12, 2005 Posted April 12, 2005 Also the line continuation character in VB "_" requires a space before it. Quote "Who is John Galt?"
Richman Posted April 12, 2005 Author Posted April 12, 2005 (edited) I have found a lot of the errors i had been including System.object line twice as VB had already entered it so i removed my line and it is now taken away a lot of them errors This is the code iam now using. Private Sub picSmile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picSmile.Click picSmile.BorderStyle =_ System.Windows.Forms.BorderStyle.FixedSingle picFrown.BorderStyle =_ System.Windows.Forms.BorderStyle.None picHappy.BorderStyle =_ System.Windows.Forms.BorderStyle.None lblMessage.Text = "Hello, world!" End Sub The =_ are still causing problems and not allowing me to run the application. Rich Edited April 12, 2005 by Richman Quote
Leaders snarfblam Posted April 12, 2005 Leaders Posted April 12, 2005 Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picSmile.Click 'These two lines of code dont belong here. ' System.Object, ByVal e As System.EventArgs)_ ' Handels(picSmile.Click) picSmile.BorderStyle = _ 'You need a SPACE before a line continuation underscore System.Windows.Forms.BorderStyle.FixedSingle '() 'And the parentheses are a syntax error, as PlausiblyDamp pointed out picFrown.BorderStyle = _ System.Windows.Forms.BorderStyle.None '() picHappy.BorderStyle = _ System.Windows.Forms.BorderStyle.None '() lblMessage.Text = "Hello, world!" End Sub Quote [sIGPIC]e[/sIGPIC]
Richman Posted April 12, 2005 Author Posted April 12, 2005 Thankyou all. Working Perfect Now. I didnt need the = _ after all :S Rich Quote
Ontani Posted April 12, 2005 Posted April 12, 2005 the _ is only when you want a long sentence or command to be devided into serveral lines. you place a space and _ and go on on the next line. i never use it Quote www.purevision.be :: www.devpoint.be
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.