Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Basic Question on Properties returning a class
 

Basic Question on Properties returning a class

Hello everybody,

I think it would be easier giving an exemple to explain my problem.

Assume you create a user control and you have a custom class called CustomClass.

In the user control, I declare the fallowing:
[VB Code]

Private mTest1 as Point
Private mTest2 as CustomClass

Public Property Test1 as Point
...
End Property

Public Property Test2 as CustomClass
...
End Property

[VB Code]

So far so good. Now the trick comes here. When I add this user control in a form, when I look at the Designer generated code, I get

[VB Code]
Me.UserControl.Test1 = New Point (0,0)
Me.UserControl.Test2 = Nothing
[VB Code]

What I would like is to have
[VB Code]
Me.UserControl.CustomClass = New CustomClass (0,0,0)
[VB Code]

I'd also like to be able to modify these parameters in the UserControl property window.
Does anyone have a clue on how to do this ?

Thanks for your help

Gnarl

MigrationUser 1  Saturday, February 05, 2005 11:37 AM
looks like you've already find the answer which is the use of typeconverter in your post at the design-time section...
MigrationUser 1  Monday, February 07, 2005 1:57 AM
Yes, but I still didn't manage to get it to work.

Thanks anyway.
MigrationUser 1  Monday, February 07, 2005 3:09 PM
Great question Gnarl, I hope someone has a good answer for this one...
MigrationUser 1  Tuesday, February 08, 2005 12:52 PM

You can use google to search for other answers

Custom Search

More Threads

• Windows Form Designer does not include the section 'Windows Forms Generated Code'
• Tranfer data between Windows Forms
• Validation With Tab Pages
• Custom control using unmanaged dll
• Setting selected state of properties in propertygrid...
• How do I activate snaplines programatically?
• Adding Design mode (Toolstrip) on C# Windows Custom Control
• System.ComponentModel
• Populating comboboxes from eachother
• Windows Form Transparency Problem