Property syntakst
HejHvordan kan det være at min text box ikke vil vise min Property?
private void Login_Click(object sender, EventArgs e)
{
textBox1.Text = Silas.PropertyUsername;
}
}
}
--------------------
Hele koden
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
SuperPerson Silas = new SuperPerson("Tim", "Dalen", "8925525", "xxxxxx@gmail.com", "test", "Bruger1", "123");
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void Login_Click(object sender, EventArgs e)
{
textBox1.Text = Silas.PropertyUsername;
}
}
}
Klassen:
public class SuperPerson
{
protected string navn;
protected string adresse;
protected string telefonnummer;
protected string mailadresse;
protected string certifikater;
protected string Username;
protected string Password;
public SuperPerson(string navn, string adresse, string telefonnummer, string mailadresse, string certifikater, string Username, string Password)
{
this.navn = navn;
this.adresse = adresse;
this.telefonnummer = telefonnummer;
this.mailadresse = mailadresse;
this.certifikater = certifikater;
this.certifikater = Username;
this.certifikater = Password;
}
public virtual string PropertyNavn
{
get { return navn; }
set { navn = value; }
}
public virtual string PropertyAdresse
{
get { return adresse; }
set { adresse = value; }
}
public virtual string PropertyTelefonnummer
{
get { return telefonnummer; }
set { telefonnummer = value; }
}
public virtual string PropertyMailadresse
{
get { return mailadresse; }
set { mailadresse = value; }
}
public virtual string PropertyCertifikater
{
get { return certifikater; }
set { certifikater = value; }
}
public virtual string PropertyUsername
{
get { return Username; }
set { Username = value; }
}
public virtual string PropertyPassword
{
get { return Password; }
set { Password = value; }
}
}
}