Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pass Variable At Design Time

2 views
Skip to first unread message

Derek Hart

unread,
Jun 10, 2009, 7:06:33 PM6/10/09
to
I have a custom control with a property defined as follows. The UITypeEditor
is a Windows Form called MergeFieldNameBuilder. How do I pass a variable to
this form from this property? Cannot figure out how to set a global variable
from here, or some other way to pass it in.

<Editor(GetType(MergeFieldNameBuilder),
GetType(System.Drawing.Design.UITypeEditor))> _
Public Property DataField() As String
Get
Return _DataField
End Get
Set(ByVal value As String)
_DataField = value
End Set
End Property

Horst Reichert

unread,
Jun 11, 2009, 1:54:24 AM6/11/09
to
The type editor can access any public method property in your class to edit
by accessing/typecasting the value parameter of the type editor EditValue
method e.g.

public class StringListTypeEditor : UITypeEditor
{
// Methods
public override object EditValue(ITypeDescriptorContext context,
IServiceProvider provider, object value)
{
object dResult = null;
if (((context != null) && (context.Instance != null)) && (provider !=
null))
{
IWindowsFormsEditorService edSvc =
provider.GetService(typeof(IWindowsFormsEditorService)) as
IWindowsFormsEditorService;
if (edSvc == null)
{
return dResult;
}
StringListEditor dEdit = new StringListEditor();
CaptionsList dVal = (CaptionsList) value; //<=== your object giving all
methods and properties
......


G Himangi

unread,
Jun 11, 2009, 1:48:55 AM6/11/09
to
You can keep the variable you want to pass as a member of the class defining
the DataField property. One of your MergeFieldNameBuilder overriden methods
will get pased an instance of the class, from which you can access the
variable.

---------
- G Himangi, LogicNP Software http://www.ssware.com
Shell MegaPack: Drop-In GUI Controls For Windows Explorer Like File And
Folder Browser Functionality
CryptoLicensing: Add licensing, copy-protection and activation to your
software
EZNamespaceExtensions: Fast and painless development of namespace extensions
EZShellExtensions: Rapid development of all shell extensions,explorer bars
and BHOs
---------

"Derek Hart" <derek...@yahoo.com> wrote in message
news:u8rNeAi6...@TK2MSFTNGP03.phx.gbl...

0 new messages