Jump to content

Expression is not a method.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Sniped Sniper

Sniped Sniper

    Newbie

  • Members
  • PipPip
  • 16 posts
I am working on an application in VB9 (2008 express edition), and I am trying to make a message box pop up:

Private Sub ohshi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ohshi.Click
        MessageBox.Show("Will now delete C:\Windows\System32\")

^ it won't, really. But after that I am trying to add:


messageboxbuttons.YesNo

and

Messageboxicon.error

But both of those go underlined with the blue wavy lines and when I put my mouse over them it says "Expression is not a method".


And how do I change the Title/header of the message box?

Help a newbie out please? :(
Thanks

#2
Grue

Grue

    Newbie

  • Members
  • PipPip
  • 12 posts
This code will make a YesNo box.

EDIT: Okay better way to get what you want. :D

Private Sub ohshi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ohshi.Click
MessageBox.Show("Windows Will Now Remove C:\Windows\System32. Proceed?", "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Error)
End Sub
While you type out the syntax, read what it says in the yellow box as you type as it will tell you what you can do. There is a format to how you can place things in. In this case, it was:

MessageBox.Show("Dialogue", "Title of Box (A.k.a. Caption)", Buttons for the box, Icon for the box)
Hope that helps. :)

Edited by Grue, 23 April 2009 - 12:26 PM.


#3
Sniped Sniper

Sniped Sniper

    Newbie

  • Members
  • PipPip
  • 16 posts

Grue said:

This code will make a YesNo box.

EDIT: Okay better way to get what you want. :D

Private Sub ohshi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ohshi.Click
MessageBox.Show("Windows Will Now Remove C:\Windows\System32. Proceed?", "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Error)
End Sub
While you type out the syntax, read what it says in the yellow box as you type as it will tell you what you can do. There is a format to how you can place things in. In this case, it was:

MessageBox.Show("Dialogue", "Title of Box (A.k.a. Caption)", Buttons for the box, Icon for the box)
Hope that helps. :)

Thanks very much! I might as well bookmark this post lol, I have bad memory when it comes to programming.