也許標題是不正確的,但我沒有其他想法如何問。 我有一個窗體與多個選項卡,使用單身。以及我的表單大約有50多個文本框,它將用戶輸入存儲到我的單例屬性中,然後保存到xml中。我的問題是讀取xml並在文本框上顯示保存到xml中的簡單路徑是什麼? 示例代碼:多個文本框2方式綁定
public class ContactInfo
{
public string Name { get { return Firstname + " " + LastName; } }
public string Firstname { get; set; }
public string LastName { get; set; }
public string PhoneNumber { get; set; }
public string Email { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string ZipCode { get; set; }
}
public class Site
{
Site()
{
OfficeAddress = new ContactInfo();
ShippingAddress = new ContactInfo();
DirectorOfOperationsFandB = new ContactInfo();
DirectorOfOperationsRetail = new ContactInfo();
SecondInCharge = new ContactInfo();
SiteController = new ContactInfo();
SiteContact = new ContactInfo();
}
public ContactInfo OfficeAddress { get; set; }
public ContactInfo ShippingAddress { get; set; }
public ContactInfo DirectorOfOperationsFandB { get; set; }
public ContactInfo DirectorOfOperationsRetail { get; set; }
public ContactInfo SecondInCharge { get; set; }
}
我開始做textbox1.text = Site.OfficeAdress.Address1;等等,但你無法想象會佔用多少線路。
這是的WinForms或WPF? – 2013-05-01 22:28:06
窗體Dan Puzey。 – 2013-05-01 22:35:47
然後,你最好的選擇可能是很多代碼行...... – 2013-05-01 22:36:48