Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / March 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan I - 06 Mar 2005 02:43 GMT
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?

Thanks- Dan I
stax - 07 Mar 2005 01:29 GMT
Hi,

try something like this:

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

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

Regards,
stax
Dan i - 07 Mar 2005 19:54 GMT
Thank you- that worked
joeycalisay - 07 Mar 2005 04:40 GMT
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.

Signature

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

> Hello again.
>
[quoted text clipped - 15 lines]
>
> Thanks- Dan I
Dan I - 07 Mar 2005 19:55 GMT

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.