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:
  1. If Not Me.DesignMode Then
  2.    DataImport = New Importer 'Error still occurs
  3. End If

i've tried this
vb Code:
  1. If Not Me.Site.DesignMode Then
  2.    DataImport = New Importer 'error still occurs
  3. 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:
  1. If Me.DesignMode Then
  2.    DataImport = New Importer 'doesn't get initialized
  3. 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