private void updateButton_Click(object sender, EventArgs e)
{
//custID.Text = customers[id].ID.ToString();
customers[id].Name = custName.Text.ToString();
customers[id].Suburb = custSuburb.Text.ToString();
customers[id].Balance = custBal.Text;
customers[id].Year_used = custYear.Text;
}
}
public class Customer
{
protected string id;
protected string name;
protected string suburb;
protected double balance;
protected double year_used;
public string ID
{
get { return id; }
}
public string Name
{
get { return name; }
set { value = name; }
}
public string Suburb
{
get { return suburb; }
set { value = suburb; }
}
public double Balance
{
get { return balance; }
set { value = balance; }
}
public double Year_used
{
get { return year_used; }
set { value = year_used; }
}
public Customer(string id, string name, string suburb, double balance, double year_used)
{
this.id = id;
this.name = name;
this.suburb = suburb;
this.balance = balance;
this.year_used = year_used;
}
}
当我尝试运行代码时似乎出现此错误?似乎是什么问题,我改变了所有有 int 的东西。
也:
customers[id].Balance = custBal.Text;
customers[id].Year_used = custYear.Text;
custBal 的正确代码是什么。和 custYear。让它显示在我的表单上?有任何想法吗?