Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is macro substitution available in .net
Message
From
10/07/2006 10:52:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01134885
Message ID:
01134981
Views:
22
>Hi Elinar
>Thanks for reply
>Can u just elaborate for how to raise the events and listen them.
>I am new to .Net
>
>Thanks

Riyaz,
It looks like you're going a wrong direction. I don't think you need reflection nor events for this. Use interfaces instead, ie:
// user control
namespace MyToolbar
{
// ...
  private System.Windows.Forms.Form _thisForm;

  public System.Windows.Forms.Form Thisform
        {
            get { return _thisForm; }
            set { _thisForm = value; }
        }
//...
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            IRecordOperations iro = _thisForm as IRecordOperations;
            if (iro != null)
                iro.AddRecord();
        }
//...  
}
//...

// your User control project IRecordOperations.cs
namespace MyToolbar
{
    public interface IRecordOperations
    {
        void AddRecord();
        void DeleteRecord();
        void FindRecord();
//...
    }
}
Let your form to implement this interface:
//...
    public partial class Form1 : Form , MyToolbar.IRecordOperations
    {
        public Form1()
        {
            InitializeComponent();
        }

        #region IRecordOperations Members
        public void AddRecord()
        {
            // Code to add a record
        }
//...
And set user control's Thisform property to your form.
PS: This is a sample. Normally it would be a base form and probably an MDI checking active child etc.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform