Thanks Joe, 

I completely forgot about ISupportInitialize and yes it does work with
extender providers.

I spent some time last night refactoring and have solved my issue.

It's a good reminder to myself that sometime challenges we face are
simply due to inadequate design :-) 


Alastair



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Joseph Clark
Sent: Tuesday, 16 February 2010 5:36 AM
To: ausDotNet
Subject: Re: designer generated file Windows forms

Hi Alastair,

I know that the ISupportInitialize interface 
(http://msdn.microsoft.com/en-us/library/system.componentmodel.isupporti
nitialize.aspx) 
was designed to help solve the problem where you need to perform 
initialisation on a Control and you have no control in which order the 
various properties are initialised. The Winforms code generator will 
reflect on your control and automatically insert the BeginInit() and 
EndInit() statements into your designer generated code.

I don't know if it works for Extender providers or not (it shouldn't be 
too hard to test it out and see if the WinForms designer recognises it 
or not, and if not, you can put your own BeginInit() and EndInit() calls

on either side of the InitializeComponents call in your Form's
constructor).

All you have to do is suppress any processing in your extender provider 
until EndInit is called.

Hope this helps,
Joe.




Alastair Waddell wrote:
>
> Hi all,
>
> Is there a way to specify where the designer puts code?
>
> I will try to explain...
>
> I have an extender provider on my form that relies on the controls 
> name but the designer file puts the code "wherever" it likes.
>
> So if I look, at the form.designer.vb file then I will see something
like
>
> ...
>
> Me.dtStartDate.ControlIsReadOnly = False
>
> Me.dtStartDate.DatePickerHeight = 22
>
> Me.dtStartDate.DatePickerWidth = 427
>
> Me.dtStartDate.DateValue = New Date(2010, 2, 2, 17, 12, 5, 917)
>
> Me.ControlValueMonitor1.SetControlValueMonitor(Me.dtStartDate, True)
>
> Me.dtStartDate.Name = "dtStartDate"
>
> ...
>
> In this case the controls name is not set att the time the provider 
> (Me.ControlValueMonitor1) is set
>
> What I want is that my 
> "Me.ControlValueMonitor1.SetControlValueMonitor(Me.dtStartDate, True)"

> to be the last line
>
> Me.dtStartDate.ControlIsReadOnly = False
>
> Me.dtStartDate.DatePickerHeight = 22
>
> Me.dtStartDate.DatePickerWidth = 427
>
> Me.dtStartDate.DateValue = New Date(2010, 2, 2, 17, 12, 5, 917)
>
> Me.dtStartDate.Name = "dtStartDate"
>
> Me.ControlValueMonitor1.SetControlValueMonitor(Me.dtStartDate, True)
>
> Any ideas?
>
> Alastair
>


-- 
Register now for Atlassian Summit 2010, June 9-11
http://summit.atlassian.com

Joseph Clark
.NET Developer

Atlassian
+61 422 812 044 mobile
173-185 Sussex St.
Sydney, NSW
Australia

Reply via email to