Hi,
I have a custom text box control that fires rules on the text leave event.
To fire the rules I need the ruleset and rules execution parameters to be passed from the form.
I was doing this using the following code
private void TextEditor_Leave(object sender, EventArgs e)
{
BaseForm FindForm =(BaseForm) this.FindForm();
if (null != FindForm.ruleExecution)
{
try
{
FindForm.ruleSetDataSet.RuleSet.Execute(FindForm.ruleExecution);
}
catch (Exception ex)
{
//MessageBox.Show("Exception thrown \n" + ex.Message);
}
}
else
{
// MessageBox.Show("RuleExecution is null");
}
}
This code has created a circular assembly reference because the baseform references the controls library but to accept the baseform I need to set a reference from my contol library to the baseform library.
Does anyone know how I could get these parameters to my control without having to reference the the baseform using BaseForm FindForm =(BaseForm) this.FindForm();
A colleague mentioned something about using the Invoke() method, can this be used
Thanks.

HELP! circular assembly reference
FernandoLeite
>> i have been told they dont want it done that way or using interfaces.
Let's recap:
1) You have a problem, but
2) "They" refuse to let you use the simple tools designed specifically to deal with that exact problem, but would apparently rather you use a complex, obscure and slow alternative.
Hmmm.... Would beating them over the head with a stick help
The one correct answer is that you need to create an interface, say IUsesRules, defined in the same assembly as your TextEditor class. It would look something like this:
2: {3: RuleType1 ruleExecution { get; }4: RuleType2 ruleSetDataSet { get; }5: }(You'll have to fill in th ecorrect data types for RuleTYpe1 & RuleType 2). Then you would code the event handler as:
2: {5: {7: {8: FindForm.ruleSetDataSet.RuleSet.Execute(FindForm.ruleExecution);9: }11: {13: }14: }16: {18: }19: }20:Note that remarkably little has changed (and even less would have changed if I'd left the potenial bug in the code). The definition of BaseForm changes even less. It goes from
class BaseForm : Form
to
class BaseForm : Form, IUsesRules
That's it. I'm sure the resistance to using an interface is base solely on cluelessness on the speakers part (let me guess --- A VB6 consultant now trying to pass himself off as a .Net expert )
Tom_Liu
pd_tch
Agent Nikko
Yeah that was my first thought but i have been told they dont want it done that way or using interfaces.
any other ideas
Thanks.