Defines a class and has two attributes. /// <Summary>
/// Metadata
/// </Summary>
[System. Diagnostics. debuggerstepthrough]
[Serializable]
Public Class Sanddata
{
String key = "" ;
Object value = "" ;
/// <Summary>
/// Metadata
/// </Summary>
Public Sanddata (){}
/// <Summary>
/// Metadata
/// </Summary>
Public Sanddata (string m_key, object m_value ){
This . Key = m_key;
This . Value = m_value;
}
Public String key
{
Get { Return Key ;}
Set {Key = value ;}
}
Public Object Value
{
Get { Return This . Value ;}
Set { This . Value = value ;}
}
}
Then, use
Arraylist list = New Arraylist ();
Foreach (Datarow row In Table. Rows)
{
String TEXT = row [ " D_name " ]. Tostring () + " [ " + Row [ " Uptownname " ]. Tostring () + row [ " Buildingname " ]. Tostring () + row [ " Unitname " ]. Tostring () + " ] " ;
String Value = row [ " ID " ]. Tostring ();
Sanddata Vo = New Sanddata ();
VO. Key = text;
VO. value = value;
List. Add (VO );
}
This . Combobox1.datasource = List;
This . Combobox1.displaymember = " Key " ;
This . Combobox1.valuemember = " Value " ;
In this way, the value of CBB. selectedvalue is obtained.