Hi Chris
A factory creates a UI control for me, like so....
if (currentTask is Eden.UITask.IUITask)
{
CurrentControl = (Control)
Eden.UITask.UITaskFactory.Instance.CreateTaskUI((Eden.UITask.IUITask)
currentTask);
CurrentControl.Location = new System.Drawing.Point(0, 0);
CurrentControl.Size = new System.Drawing.Size(this.ClientRectangle.Right,
NavigationPanel.Location.Y - 1);
this.Controls.Add(CurrentControl);
}
That all works just fine, the control is created and then inserted into my
form.
Next I check to see if the created control has an Initialize requirement,
like so......
initializeGui = CurrentControl as
Eden.HandheldVendor.TaskFlow.UI.IInitializeGui;
if (initializeGui != null)
initializeGui.InitializeGui();
In my InitializeGui() all I do is this....
LoginTextBox.DataBindings.Add("Text", ValidateUser, "Login");
PasswordTextBox.DataBindings.Add("Text", ValidateUser, "Password");
If I comment out those two lines, everything works just fine (without
binding), but as soon as I add those two lines I get a
NullReferenceException, which doesn't really tell me much at all
The Login/Password properties are declared like so....
public string Login
{
get
{
return login;
}
set
{
login = value;
}
}
public string Password
{
get
{
return password;
}
set
{
password = value;
}
}
I only added the InitializeGui() call incase the databindings required the
control to be connected to a form before they would work, so I add the
databindings after the control has been inserted into the form.Controls
This is really confusing me, any help would be greatly appreciated!
Thanks
Pete