Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check please!

Status
Not open for further replies.

SonJ

Programmer
Oct 24, 2002
166
GB
Hi,

Can anyone tell me whats wrong with this code:

Code:
<script runat=&quot;server&quot;>
  sub ImageButton_Click (s as object, e as EventArgs)
    lblXLocation.text=e.X
    lblYLocation.text=e.Y
    
    if e.X=100 and e.Y=100 then
      lblMessage.Text=&quot;You win&quot;
    else
      lblMessage.Text=&quot;You lose&quot;
    end if
  end sub
</script>

<html>
  <head><title>Image.aspx</title></head>
  <body>
    Hit the image at 100*100
    <form runat=&quot;server&quot; ID=&quot;Form1&quot;>
      <asp:ImageButton ImageUrl=&quot;Images/Icon.jpg&quot; OnClick=&quot;ImageButton_Click&quot; Runat=&quot;server&quot;/>
      <p>x coordinate: <asp:Label id=&quot;lblXLocation&quot; runat=&quot;server&quot;/></p>
      <p>y coordinate: <asp:Label id=&quot;lblYLocation&quot; runat=&quot;server&quot;/></p>
      <p><asp:Label ID=&quot;lblMessage&quot; Runat=&quot;server&quot;/></p>
    </form>
  </body>
</html>

The code is an example taken from asp.net unleashed by Stephen Walther, but fails to compile in the browser.

I am new to asp.net, but have been doing asp for ages. Is there an equivalent to on error goto 0 in asp.net?

Thanks in advance,
SonD
 
Found it:
Code:
sub ImageButton_Click (s as object, e as EventArgs)

should read
Code:
sub ImageButton_Click (s as object, e as ImageClickEventArgs)

If anyone knows of an equivalent for on error goto 0 for asp.net then I would be v interested!

SonD
 
The Goto command still is available within VB.NET I believe, however it's recommended that you now make use of the Try.. Catch... Finally block instead.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top