WinForm沒有好不方便~筆記一下*0*

/// 首先添加類別ListItem:
/// 用於ComboBox或是ListBox
/// 
public class ListItem
{ 
private string id = string.Empty;
private string name = string.Empty;
//根據自己的需求繼續添加 如:private Int32 m_Index;
//建構式
public ListItem()    
{   } 
public ListItem(string sid, string sname) 
{ 
id = sid; 
name = sname; 
}
//override ToString()的動作
public override string ToString()   
{   
return this.name;
}
//設定或取得ListItem的ID
public string ID 
{ 
get
{
return this.id;
} 
set
{
this.id = value;
} 
} 
//設定或取得ListItem的Name
public string Name 
{ 
get
{
return this.name;
} 
set
{
this.name = value;
} 
} 
}
沒有留言:
張貼留言
您可以使用一些 HTML 標記,例如 <b>, <i>, <a>