Hi, I have the following code I got from divil (Introduction to Designers):
[csharp]using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.ComponentModel.Design;
using System.Windows.Forms.Design;
namespace CSharpTest
{
[Designer(typeof(MyControlDesigner))]
public class UserControl1 : UserControl {
public Button button1 = new Button();
public void TestMethod() { }
}
internal class MyControlDesigner : ControlDesigner {
public override DesignerVerbCollection Verbs {
get {
DesignerVerbCollection v = new DesignerVerbCollection();
v.Add(new DesignerVerb("Sample Verb", new EventHandler(SampleVerbHandler)));
return v;
}
}
private void SampleVerbHandler(object sender, System.EventArgs e) {
// CODE GOES HERE
}
}
}[/csharp]
This codes places a task link in my subclassed usercontrol that I have placed on a form:
I need to know how can I acces the controls/methods in the UserControl1 class inside the SampleVerbHandler().
Is this possible, how?
[csharp]using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.ComponentModel.Design;
using System.Windows.Forms.Design;
namespace CSharpTest
{
[Designer(typeof(MyControlDesigner))]
public class UserControl1 : UserControl {
public Button button1 = new Button();
public void TestMethod() { }
}
internal class MyControlDesigner : ControlDesigner {
public override DesignerVerbCollection Verbs {
get {
DesignerVerbCollection v = new DesignerVerbCollection();
v.Add(new DesignerVerb("Sample Verb", new EventHandler(SampleVerbHandler)));
return v;
}
}
private void SampleVerbHandler(object sender, System.EventArgs e) {
// CODE GOES HERE
}
}
}[/csharp]
This codes places a task link in my subclassed usercontrol that I have placed on a form:
I need to know how can I acces the controls/methods in the UserControl1 class inside the SampleVerbHandler().
Is this possible, how?