Question : UI Type Editor in VS2010

I'm building a custom server control that has a "Text" property. I want to be able to edit that property in a large dialogue box as it often contains a lot of text.

I can't seem to get the right Editor settings  What goes in the "?" spaces
********************************************
 <Bindable(True), Category("Appearance"), DefaultValue(""), Localizable(True), Editor(GetType(?), GetType(?))>
    Property Text() As String
        Get
            Dim s As String = CStr(ViewState("Text"))
            If s Is Nothing Then
                Return "[" & Me.ID & "]"
            Else
                Return s
            End If
        End Get

        Set(ByVal Value As String)
            ViewState("Text") = Value
        End Set
    End Property
************************************

Thanks

Answer : UI Type Editor in VS2010

Sorry, I don't know of an existing one, but if you use BigStringEditor and UITypeEditor for the "?"s, and define a class BigStringEditor as in the included code (sorry, I don't have VB.Net on my machine, but the code should be almost the same) then when you click in the property a "..." will appear (I think you need to set Browsable(true) also)  and if you click on that a 100x100 dialog will appear which will let you edit.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
public class BigStringEditor: UITypeEditor
    {
        public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }

        IWindowsFormsEditorService editorService = null;

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService =
                    provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (editorService != null)
            {
                Form foo = new Form();
                TextBox tb = new TextBox();
                tb.Multiline = true;
                tb.Height = 100;
                tb.Width = 100;
                foo.Height = 100;
                foo.Width = 100;
                tb.Text = value.ToString();
                foo.Controls.Add(tb);
                editorService.ShowDialog(foo);
                return tb.Text;
            }

            return value;
        }


    }
Random Solutions  
 
programming4us programming4us