Detect design time in UserControl

by johan.sassner 31. August 2008 13:53
Creating a UserControl for a program, i ran into the problem of detecting whether i was running code in design mode or not. The problem with the DesignMode property from the Component class is that it doesn't work properly in the constructor. I created an overload of the property:
   1:  public new bool DesignMode {
   2:      get {
   3:          return (Process.GetCurrentProcess().ProcessName.Equals("devenv",
   4:  StringComparison.OrdinalIgnoreCase));
   5:      }
   6:  }

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

.Net

Konstiga Coca cola light burkar

by johan.sassner 15. August 2008 13:45

Såg dessa två burkar i affären och var tvungen att prova dem.

Green Tea får 2/10 - alldeles för sur för min smak.

Vitamins får 7/10 - en bismak som jag inte kan identifiera.

Well, jag kommer inte att köpa fler.

 

cola_flaskor

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Misc

Error 80131534 when loading addin

by johan.sassner 11. August 2008 10:31

Edit 2008-08-13: Problem solved. See below for the initial error.

I was on the completely wrong track (of course). As i said below i'm creating an addin for SSMS, and addins is loaded from whitin SSMS and it looks for a class implementing interface IDTExtensibility2. All i got from in the output log from Visual Studio was two exceptions (System.NullReferenceException and System.TypeInitializationException) and the first should have put me on the right track but it didn't and i've lost 3 days of coding. I didn't get the contents of the exceptions (for example stacktrace or any innerexceptions) so i had nothing to continue my search.

The error message i got was "Error Message: <Unknown Error>. Error number: 80131534", which didn't help me at all. After 3 days i got a hunch and created a new empty project, adding the addin as a reference and executed it.

Connect connect = new Connect();
Array poff = null;
connect.OnConnection(null, Extensibility.ext_ConnectMode.ext_cm_Startup, null, ref poff);
[/code]

Now i got the exception dialog and was able to trace it to a static class with some static member variables using a helper class. In that helper class i had added a .toString() for one of the parameters and ofcourse the static member variables supplied null in the parameter and there is the System.NullReferenceException.

Problem solved!

------------------

I get the error below when trying to load my addin in SSMS. It might be that .Net framework 3.5 seems to be a bit corrupt on my machine since when i try to re-install framework 3.5 i get an error. Today 3.5 sp1 will be released so i'll try that and update this post.

Edit: I tried to do a repair in "Uninstall or change a program" which reported success, but i still get the same error.

Edit: Installed both sp1 of Visual Studio 2008 and sp1 of .Net 3.5 and still same error.

 

---------------------------
Microsoft SQL Server Management Studio
---------------------------
The Add-in 'xxx addin, SQL Server Management Studio Extension' failed to load or caused an exception.
Would you like to remove this Add-in?
If you choose yes, you will need to reinstall the Add-in to use it again.

Error Message: <Unknown Error>
Error number: 80131534
---------------------------
Yes   No  
---------------------------

 

image

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Extending Visual Studio

Träning för gravida

by johan.sassner 10. August 2008 22:07
Bebisar är rätt så söta...

Shit, det var ju ett högrisk-projekt att besöka en tre veckor gammal bebis. Särskilt när föräldrarna dumpade den underbara varelsen i knät på en så snart man klivit innanför dörren och lite senare även tilldelade en ett stycke nappflaska och lät en mata den...

Källa: http://www.metrobloggen.se/jsp/public/permalink.jsp?article=19.3835272

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Misc

IKEA chips

by johan.sassner 3. August 2008 13:19

För 5 kronor var dessa IKEA chips helt ok. Lite som lantchips.

ikea_chips

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Misc

JetBrains Omea cookie problem

by johan.sassner 3. August 2008 12:29

Do you ever get "An error occured when parsing the Cookie Header for Uri" error when using the awesome JetBrains Omea rss reader? I've had so for a very long time, but today I solved it permantly. I was messing around in the settings window and found the setting "Use cookies from" which was set to "Internet Explorer". I just changed it to "None" and everything worked after that!

 

image

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Tools

Malte

by johan.sassner 2. August 2008 17:06

Nils Malte Sassner föddes 20:e juli 00.48.

 Trött Malte

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Misc

WotLK release date!

by johan.sassner 1. August 2008 21:03
"But Mike Morhaime just confirmed a Q4 2008 release by saying that WotLK will be out this year, and not in Q3."

from Tobolds blog: http://feeds.feedburner.com/~r/ToboldsBlog/~3/352480143/wotlk-release-date.html

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Gaming

Why can functions be aliases?

by johan.sassner 1. August 2008 18:16

Anyone else but me wondered why TSQL allows functions to be aliases?

The sql shown below executes correctly (in MS Sql 2005).

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Sql

Dark color scheme

by johan.sassner 1. August 2008 16:52

I've been using a dark color scheme for Visual Studio (using Resharper options) and also in Sql Server Management Studio.

Attached are both the visual studio 2008 settings that you need to import under Tools->Import and Export Settings, and the .reg file that you need to add.

Make a backup of both the VS settings by exporting your old one first, and make a backup of the compete registry key HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell\FontAndColors (i usually just rename FontAndColors before i import the .reg file).

After applying the new files, restart both VS and SSMS.

 NOTE!!! You do this on your own risk. Those files work on my setup, but they may break your machine. I take no responsibility if you destroy your registry.

 

VS2008_20080729.vssettings (15.53 kb)

sql2005_2008-08-01.reg (146.60 kb)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Extending Visual Studio

Powered by BlogEngine.NET 1.4.5.7
Theme by Mads Kristensen

About the author

I've been working with software for a long time now. Started on ABC80 in the early 80's, then Commodore 64/Amiga. Working as a systemdeveloper today with focus on .Net.

Now proud father of Malte

Page List

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar