| Forum: ASP.NET |
Thema:
Re: Fehlermeldung: Object reference not set to an instance of an object. |
Von:
G. Guest (
28.11.2003 15:59) |
Auszug aus meiner Ascx-Codebehind Datei
public class Adresse : System.Web.UI.UserControl
{
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Strasse;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Ort;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Land;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Postleitzahl;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Hausnummer;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Geburtsdatum;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Nachname;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Vorname;
protected System.Web.UI.HtmlControls.HtmlInputText Txt_Adresszusatz;
protected System.Web.UI.WebControls.CompareValidator Val_von_Geburtsdatum;
protected System.Web.UI.WebControls.CompareValidator Val_bis_Geburtsdatum;
public System.Web.UI.WebControls.TextBox MyTextBox;
protected System.Web.UI.HtmlControls.HtmlSelect cbo_Anrede;
public String Geburtsdatum
{
get
{
return Txt_Geburtsdatum.Value;
}
set
{
Txt_Geburtsdatum.Value = value;
}
}
In der ASPX Datei habe ich folgendes geschrieben:
*************************************************
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox1;
Adresse my1 = new Adresse();
private void Page_Load(object sender, System.EventArgs e)
{
this.TextBox1.Text= my1.MyTextBox;
Ich möchte auf die TextBox zugreifen (ist public) oder über eine definierte Schnittstelle. Das klappt aber auch nicht (get, set)
Antworten
Vorsicht bei der Eingabe: Die Zeichen ' oder -- sind nicht erlaubt!