Hallo zusammen,
Ich habe folgendes Problem: Ich habe eine Form bzw. Webform erstellt und sämtlichen Programmcode in die partielle Klasse ausgelagert, die Visual Studio mir erstellt hat, damit sich Gui Elemente und Programmlogik nicht vermischen und das Programm somit unübersichtlich wird.
Meine selbst erstellte C Sharp Klasse:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| namespace Dateneingabe { public class MySQLDatabaseConnection { private Page formular;
public MySQLDatabaseConnection(Page formular) { this.formular = formular; }
void irgendeineMethodeXYZ(string text) { formular.Label1Feld.Text = text;
}
} } |
Die von Visual Studio erstellte Partielle Klasse:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| namespace Dateneingabe { public partial class Formular : System.Web.UI.Page { private MySQLDatabaseConnection mysqldatabaseconnection; public Formular() { this.mysqldatabaseconnection = new MySQLDatabaseConnection(this); this.mysqldatabaseconnection.irgendeineMethodeXYZ(ABC); } } } |
Ich erhalte folgende Fehlermeldung beim Kompilieren:
private MySQLDatabaseConnection mysqldatabaseconnection; ist nicht vorhanden, evtl. fehlt eine using Direktive oder Assemblyverweis
Bei der Zeile formular.Label1Feld.Text = text; kann ich nicht kompilieren, da Label1Feld nicht erkannt wird.
Ich verstehe diese Fehlemeldungen nicht so wirklich.
Grüße
Dennis