[RESOLVED] [2008] DesignMode does not work
i've searched looking for an answer... i've tried everything and yet Me.DesignMode does not do what it's suppose to do.
this is the code i have in a usercontrol in the constructor
vb Code:
If Not Me.DesignMode Then
DataImport = New Importer 'Error still occurs
End If
i've tried this
vb Code:
If Not Me.Site.DesignMode Then
DataImport = New Importer 'error still occurs
End If
however as soon as i comment out the initialization of the DataImport everything is freaking happy...
now for the wonderful twist... which makes no sense...
if i do this
vb Code:
If Me.DesignMode Then
DataImport = New Importer 'doesn't get initialized
End If
and clean and rebuild the solution the control load with no problem.... however at runtime when i try and call a method in the Importer class it obviously fails because it's not initialized. i'm soon just going to place my initialization in the load event which is not were i really want it, but at least it will work. so i'm hoping someone can shed some light on this.
this is seriously stressing me out:eek2:
Re: [2008] DesignMode does not work
Did you try this?
VB.NET Code:
If Not Me.DesignMode = True Then
Re: [2008] DesignMode does not work
yea i tried that still same problem, but thanks for the reply.
Re: [2008] DesignMode does not work
Quote:
Originally Posted by D4rkness
Did you try this?
VB.NET Code:
If Not Me.DesignMode = True Then
Comparing a boolean with another boolean, to create a third boolean that will be evaluated (which will in fact have the same value as the first boolean))..will not do a thing, and is unnecessary.;)
Re: [2008] DesignMode does not work
i've been doing some digging and searching on the net, and it looks as though it's a bug that was reported to MS
https://connect.microsoft.com/Visual...dbackID=107688
Re: [2008] DesignMode does not work
well i just put the part that i needed into the load event... which still failed, but after placing the Me.DesignMode in the load event it worked... so i'm guessing there's no way that you can determine if a control is in design mode from within the constructor.
i thought that the designmode property would be initialize when initializecomponents is called, hence one of the reasons the comments say to place any initializing code after that.
oh well it works now