Windows Develop Bookmark and Share   
 index > Windows Forms Designer > UITypeEditor and Modal form not showing
 

UITypeEditor and Modal form not showing

I am trying a custom editor dialog box (modal form)which will allow user to edit property values. But the property is shown faded in the properties window. And also the ellipsis button is not visible. Can anybody please assist me in resolving this issue. The code for each of the modules are given below

Code for the UserControl and UITypeEditor

namespace

WindowsApplication1

{

public partial class SSDBCombo : UserControl

{

string _stest = "";

public SSDBCombo()

{

InitializeComponent();

}

[

EditorAttribute(typeof(FormEditorCombo), typeof(UITypeEditor))]

[

BrowsableAttribute(true)]

public string StrTest

{

get

{

return _stest;

}

set

{

_stest =

value;

}

}

}

public abstract class FormEditorCombo : UITypeEditor

{

WindowsApplication1.

UserControlForm m_EditControl;

Boolean m_Escaped;

IWindowsFormsEditorService IEditiorService;

public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)

{

return UITypeEditorEditStyle.Modal;

}

public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)

{

if (context != null && provider != null)

{

IEditiorService = (

IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

if (IEditiorService != null)

{

string PropName = context.PropertyDescriptor.Name;

m_EditControl =

new UserControlForm();

if (m_EditControl != null)

{

IEditiorService.ShowDialog(m_EditControl);

m_EditControl.SText = value.ToString();

}

return m_EditControl.SText;

}

}

return base.EditValue(context, provider, value);

}

}

  • Moved byeryangMSFTMonday, September 14, 2009 2:22 AM (From:.NET Base Class Library)
  •  
Amit Gadre  Saturday, September 12, 2009 9:02 AM
Remove "abstract" from the FormEditorCombo class declaration and it will work fine.

Hans Passant.
  • Marked As Answer byAmit Gadre Monday, September 14, 2009 5:42 AM
  •  
nobugz  Saturday, September 12, 2009 10:07 AM
Remove "abstract" from the FormEditorCombo class declaration and it will work fine.

Hans Passant.
  • Marked As Answer byAmit Gadre Monday, September 14, 2009 5:42 AM
  •  
nobugz  Saturday, September 12, 2009 10:07 AM
Thanks for quick response. And it works according to the above suggestion. Now I am trying to edit a value in the editor for and trying to set the value to the corresponding property. How to go about that? I am not finding any way to do that. Can anybody please help me out?
Amit Gadre  Monday, September 14, 2009 5:42 AM
Amit:

It is best if you post a new topic. This one is marked as answered (as it should be because you found the answer to your original question) and people browsing the forum might skip this topic because it will show as answered.

Also note something: If you edit a post that contains code, the code gets all messed up. I am rather new here, so I have found that the only way of getting it right is to re-enter it (delete the "old" and replace with a fresh copy). Having the code well presented goes a very long way.

Cheers!
MCP
webJose  Tuesday, September 15, 2009 1:48 AM

You can use google to search for other answers

Custom Search

More Threads

• TextBox classes do not have thie method: set_AutoSize(true)
• "Window class name not valid" error in designer
• Default Enter and Cancel button C# Winforms?
• Copy paste problems
• Nested InstanceDescriptors (short)
• How to make a Picturebox accept focus
• Let the user add components
• DataGrid and Treeview...Very Imp...
• Unable to copy a custom control in the designer
• Couldn't find System.ComponentModel.Design.CollectionEditor