Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Administrators
Posted

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?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted (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 by Richman
  • Leaders
Posted
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

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...