C
Cedric
Hi,
I'm creating a c# assembly with many controls: lookup
comboboxes such as country & currency comboboxes.
I want this assembly to be used by many windows
applications & it shouldn't care how it gets the lookup
data (Web service, remoting, direct).
I looks like this:
namespace ISA.WinUserControls
{
/// <summary>
/// Summary description for cbCountries.
/// </summary>
public class cbCountries:
Syncfusion.Windows.Forms.Tools.ComboBoxAdv
{
private
ISA.BE.dsLookup.countriesDataTable Countries;
public cbCountries()
{
this.FlatStyle =
Syncfusion.Windows.Forms.Tools.ComboFlatStyle.System;
}
public cbCountries(
ISA.BE.dsLookup.countriesDataTable t): this()
{
DataTable = t;
}
public ISA.BE.dsLookup.countriesDataTable
DataTable
{
set
{
Countries = value;
DataSource = Countries;
ValueMember =
Countries.Columns[0].ColumnName;
DisplayMember =
Countries.Columns[1].ColumnName;
}
}
}
}
Somewhere, the application initializes one and for all an
ISA.BE.dsLookup & pass the right table to the constructor
of the control.
The problem is, the VS.Net designer always initialize
controls with a constructor without parameters in the
InitializeComponent() function, e.g. this.cbCountry1 =
new ISA.WinUserControls.cbCoutries(); If I change it to
this.cbCountry1 = new ISA.WinUserControls.cbCoutries
(dsLookupSingleton.Countries), it works but should I
change the form/component with the designer later,
everything breaks.
A better solution would be to somehow initialize the
assembly once, which would initialize every control with
the data once. Does anybody know how to do it?
Thanks,
Cedric
I'm creating a c# assembly with many controls: lookup
comboboxes such as country & currency comboboxes.
I want this assembly to be used by many windows
applications & it shouldn't care how it gets the lookup
data (Web service, remoting, direct).
I looks like this:
namespace ISA.WinUserControls
{
/// <summary>
/// Summary description for cbCountries.
/// </summary>
public class cbCountries:
Syncfusion.Windows.Forms.Tools.ComboBoxAdv
{
private
ISA.BE.dsLookup.countriesDataTable Countries;
public cbCountries()
{
this.FlatStyle =
Syncfusion.Windows.Forms.Tools.ComboFlatStyle.System;
}
public cbCountries(
ISA.BE.dsLookup.countriesDataTable t): this()
{
DataTable = t;
}
public ISA.BE.dsLookup.countriesDataTable
DataTable
{
set
{
Countries = value;
DataSource = Countries;
ValueMember =
Countries.Columns[0].ColumnName;
DisplayMember =
Countries.Columns[1].ColumnName;
}
}
}
}
Somewhere, the application initializes one and for all an
ISA.BE.dsLookup & pass the right table to the constructor
of the control.
The problem is, the VS.Net designer always initialize
controls with a constructor without parameters in the
InitializeComponent() function, e.g. this.cbCountry1 =
new ISA.WinUserControls.cbCoutries(); If I change it to
this.cbCountry1 = new ISA.WinUserControls.cbCoutries
(dsLookupSingleton.Countries), it works but should I
change the form/component with the designer later,
everything breaks.
A better solution would be to somehow initialize the
assembly once, which would initialize every control with
the data once. Does anybody know how to do it?
Thanks,
Cedric