c# as is a keyword

Associate
Joined
19 Jul 2006
Posts
1,847
Hi,
Just messing about with this, can get it to work with vb but want it in c#
Want the current time to display in the text box, but get a
Compiler Error Message: CS1041: Identifier expected, 'as' is a keyword
error
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%@ Page Language="c#" %>
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs);
	currentDT.Value  = DateTime.Now
	End Sub
	
</script>
</head>

<body> 
 <% Response.Write("Hello World"); %>.
 <form runat="server">
 <input type="text" runat="server" id="currentDT" /></form>
</body>
</html>
 
I think your problem is that you've just changed the page language to c# but the code is still in VB. I'd suggest reading up on C# :)

I beleive it goes something like thisun

Code:
<script runat="server" language="C#">
void Page_Load(Object s, EventArgs e) {
  stuff;
  stuff;
}
</script>
 
Thanks im stuck here with out my C# book only got a crappy VB book with me, thought it may be to easy just to change the language.
 
Back
Top Bottom