#region "Custom Properties"
<summary>
Error messages that may occur when populating
</summary>
public string Error
{
Get
{
Return terror;
}
}
<summary>
Combo controls can bind to data tables
</summary>
Public System.Data.DataTable souredatatable
{
Get
{
return tsourcedatatable;
}
Set
{
Tsourcedatatable=value;
}
}
<summary>
A collection of arrays of data to be saved as a combo data source
</summary>
Public System.Collections.ArrayList Sourearray
{
Get
{
return tsourcearray;
}
Set
{
Tsourcearray=value;
}
}
<summary>
The name of the index field provided by the Data source table
</summary>
public string Indexfieldname
{
Get
{
return tindexfieldname;
}
Set
{
Tindexfieldname=value;
}
}
<summary>
The name of the content field provided by the Data source table
</summary>
public string Valuefiledname
{
Get
{
return tvaluefieldname;
}
Set
{
Tvaluefieldname=value;
}
}
<summary>
The combobox control that will be bound
</summary>
Public System.Windows.Forms.ComboBox ComboBox
{
Get
{
return tcombobox;
}
Set
{
Tcombobox=value;
}
}
#endregion
<summary>
Populate the Data source table with the array set merge to ComboBox
</summary>
<returns></returns>
public bool Bindcomboboxbydatatable ()
{
Try
{
foreach (DataRow tdatarow in Tsourcedatatable.rows)
{
String[] M=null;//=new string[totherfield.length];
if (totherfield!=null)
{
if (totherfield.length>0)
{
M=new String[totherfield.length];
for (int i=0;i<=totherfield.length-1;i++)
{
M[i]=tdatarow[totherfield[i]]. ToString ();
}
}
}
Tsourcearray.add (New Mycomboboxitem (Tdatarow[tvaluefieldname). ToString (),
Convert.ToInt32 (Tdatarow[tindexfieldname]), m);
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service