all groups > dotnet windows forms designtime > march 2005 >
You're in the

dotnet windows forms designtime

group:

how to force windows forms designer to generate code...


how to force windows forms designer to generate code... Dan I
3/5/2005 8:43:22 PM
dotnet windows forms designtime:
Hello again.

I was wondering if any of you have experienced the following behavior. I
wrote a custom type editor and a custom collection editor. Both work as
expected. The problem lies with the collection editor.

If I launch the collection editor via the property grid, the editor comes
up. It can add, remove, etc... everything works well. When I click 'Ok' in
the collection editor, the property grid reflects that the collection was
appropriately changed. However, the forms designer doesn't modify the
generated code to reflect the changes *until* I do something else on the
form that modifies the code (i.e.- move a control or resize it). If I do
this, the next time I inspect the code, it has been modified with the
changes that were made in the property grid and the custom designers.

So... how, after a property change or an addition to a collection, do I
tell Windows forms to rethink its code?

Re: how to force windows forms designer to generate code... stax
3/7/2005 2:29:54 AM

Hi,

try something like this:

Dim ccs As IComponentChangeService = _
Type(GetService(GetType(IComponentChangeService)), _
IComponentChangeService)

ccs.OnComponentChanged(Me, Nothing, Nothing, Nothing)

Regards,
Re: how to force windows forms designer to generate code... joeycalisay
3/7/2005 12:40:17 PM
you just have to notify the designer through the IComponentChangeService by
Raising the appropriate events. You'll get a reference of the
ITypeDescriptorContext from the EditValue method, you just have to call its
OnComponentChanging and OnComponentChanged methods appropriately.

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/


[quoted text, click to view]

Re: how to force windows forms designer to generate code... Dan i
3/7/2005 1:54:59 PM
Thank you- that worked
Re: how to force windows forms designer to generate code... Dan I
3/7/2005 1:55:54 PM
AddThis Social Bookmark Button