Ciao a tutti,
mi sono recentemente avvicinato a .net e sto incontrando dei problemi con il recupero dei valori di un form nel mio file di codice (CodeFile). In particolare, nella pagina utilizzo i tag HTML <input> impostando l'attributo runat="server", ma nella mia classe che sta dietro la pagina non riesco a recuperare i valori (di un campo text) utilizzando NomeCampo.Value.

Ho provato ad importare diversi namespace, ma senza risultato.

form.aspx
codice:
<%@ Page Language="VB" AspCompat="true" Inherits="FormCommand" CodeFile="form.aspx.vb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
	Dim SystemForm As New FormCommand

	If Page.IsPostBack Then
		SystemForm.Check
	End If
%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>Titolo</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	</head>
	<body>
	    <div id="main">
				<form id="MyForm" action="form.aspx" method="post" enctype="multipart/form-data" runat="server">
					Testo:

					<input type="text" id="MyText" runat="server" />

					<input type="submit" id="MySubmit" />

				</form>		
	    </div>
	</body>
</html>

form.aspx.vb
codice:
Partial Public Class FormCommand
	Inherits System.Web.UI.Page

	Public ErrorMessage As String

	Public Sub Check()
		' MyText
		If (MyText.Value = "") Then
			ErrorMessage = "Il campo MyText non &egrave; valido"
		End If
	End Sub
End Class
L'errore mi viene dato alla riga
codice:
If (MyText.Value = "") Then
ed è

System.NullReferenceException: Object reference not set to an instance of an object


Qualcuno sa a cosa potrebbe essere dovuto?

Grazie mille!