Friday, September 12, 2008

How to set GRUB to boot Windows by default :)

Yeah so you must dual boot to know what the other side is up to but hey, I use the Windows partition an hell of a lot more than I do my Ubuntu side. But if I',m not near my laptop during the boot up it goes into Ubuntu and the I have fun playing around with Compiz and then I shut it down. Only to forget a second time and boot into the wrong side again :) Any a quick solution is this
1. open a terminal window and type:
gksu gedit /boot/grub/menu.lst

2. Then scroll to the bottom, and move the windows entry above the ubuntu entry, then simply save and exit.

Tuesday, April 22, 2008

Power commands for Visual Studio 2008

PowerCommands 1.1 is a set of useful extensions for the Visual Studio 2008 adding additional functionality to various areas of the IDE. The source code is included and requires the VS SDK for VS 2008 to allow modification of functionality or as a reference to create additional custom PowerCommand extensions. Visit the VSX Developer Center at for more information about extending Visual Studio.

For a list of features look here.

If this is for you you can download it here.

Friday, March 28, 2008

From MCT to DPE !!

I've just signed my contract to start working as a .NET Platform Developer Evangelist with Microsoft!! I'm really excited to be part of the Microsoft team here in Malta and some of the challenges that lie ahead are really great. It's a chance to interact in a deep way with some great people that work on the Microsoft products that I've used everyday and taught so many people how to use, plus the chance to get involved with a lot of the cutting edge technology that Microsoft are currently working on.

If ever you've heard the term above and wondered what exactly it's all about, here is a quick run down.

  • Engaging the broad community of Developers in Academia and the public and private sectors,
  • Driving excitement around Microsoft's software developer related technologies,
  • To interact through events, specialist training workshops, community engagement, relationship marketing and the growth of an exciting solutions portfolio.

More details to follow as I find out more about the role!!!

Wednesday, March 26, 2008

Domain specific language - Primer

Perhaps you may have seen this term in VS2008 when it loads up on the start screen or perhaps you have seen it in some academic course of study, or perhaps you have no idea what it is!! Well this short post will hopefully give you some answers to what it is, why you need it and how to get started using it.

What is it?
Well firstly it is not a GPL, a general purpose language like VB.NET,C# or any other programming language that lets you code using a specific language to suite a diverse set of tasks. It’s actually the other way round, it’s useful for a specific task to fix a problem within that domain. Using it allows you to build a modeling tool or define a modeling language for that task. It also makes implementing the solution to that problem a lot easier, however it does shift a lot of the work up front. i.e developing the tool is hard work, but once it’s built it’s a lot easier to solve problems using it!!! Domain-specific languages focus on doing one kind of task well. It’s kinda like UML, but without the U.

What can you do with it?
For example, you can create a specialized language that describes a user interface, a business process, a database, or the flow of information, and then you can generate code from those descriptions. The DSL does not have to fit just IT or programming tasks, you may wish to model other things like solar systems. By using Domain-Specific Language Tools, you can create a custom graphical designer that uses your Domain-specific diagram notation. You can then create custom text templates that use models that are created in your designer to generate source code and other files.
What tools are there out there?

What does the VS2008 DSL tool consist of ?
· A project wizard that creates a fully configured solution. In this solution, you can define a domain model that consists of a designer and a text output generator. If you run a completed solution from inside Visual Studio, a test solution opens in a separate instance of Visual Studio so that you can test the designer and the text output generator.

· A graphical designer for defining and editing domain models.

· Designer definitions in XML. The code for implementing designers is generated from these definitions so that you can define a graphical designer hosted in Visual Studio without manually writing any code.

· A set of code generators, which take a domain model definition and a designer definition as input and produce code that implements both of the components as output. The code generators also validate the domain model and the designer definition, and they raise errors and warnings accordingly.
· A framework for defining text output generators. These template-based generators take data (models) that use a domain model as input and generate text output that is based on the template. Parameters in the template are substituted by using the results of running a Visual C# script that is embedded in the template.

What VS editions support DSL
For creating a DSL you will need any of the following:
· Visual Studio 2008 Professional Edition
· Visual Studio 2008 Team Edition for Software Architects
· Visual Studio 2008 Team Edition for Software Developers
· Visual Studio 2008 Team Edition for Software Testers
· Visual Studio 2008 Team Suite

In order to use the DSL you create you will need on of the following VS IDE’s@
· Visual Studio 2008 Standard Edition
· Visual Studio 2008 Professional Edition
· Visual Studio 2008 Team Edition for Software Architects
· Visual Studio 2008 Team Edition for Software Developers
· Visual Studio 2008 Team Edition for Software Testers
· Visual Studio 2008 Team Suite

OK so not much choice, you can’t use VS2005 or 2003 I’m afraid.

OK enough already! How do I create a DSL? That will be the topic of my next post!!

Thursday, March 20, 2008

New Visual Studio 2008 Certifications

Microsoft Learning have released six MCTS certifications on Visual Studio 2008. Two exams are required for each, just like for the 2005 track, and luckily the same code is required for all six, and it's the same core exam that was used for 2005 certifications.

The following core exam is required for all six certifications.
Exam 70-536: TS: Microsoft .NET Framework 2.0 – Application Development Foundation

The actual certifications can be divided into two, ones which are the .NET Framework 3.5 versions of the previous tracks, and those wich are brand new technologies.

Similar to the previous ones are:
  • MCTS: .NET Framework 3.5, Windows Forms Applications, Exam
  • MCTS: .NET Framework 3.5, ADO.NET Applications, Exam 70-561
  • MCTS: .NET Framework 3.5, ASP.NET Applications, Exam 70-562

Brand new technologies are:

  • MCTS: .NET Framework 3.5, Windows Presentation Foundation Applications, Exam 70-502
  • MCTS: .NET Framework 3.5, Windows Communication Foundation Applications, Exam 70-503
  • MCTS: .NET Framework 3.5, Windows Workflow Foundation Applications, Exam 70-504

Most of these exams have not yet been released but should be available this month or next

Monday, March 17, 2008

My new Gadget I forgot to blog about

This is something I got back in January from Berlin. I MUST say a great big THANK YOU to Tjeerd Veninga at Microsoft for asking me to help as part of the MCT planning Commitee for the MCT summit. It was great collaborating with so many great people around Europe and then to finally meet them all at such a great event.

Anyway was was the gadget, well its a Solar powered charger that is so versatile!! It's made by a company called PowerGuy. They do loads of battery stuff but this is great. It can be charged from the mains, the USB on a PC or by the sun, which here in Malta is abundant!!! Once fully charged it can discharge into any device, loads of phone models, including my HTC touch!!! Here are some picks:

Sunday, March 16, 2008

Low audio volume on HP 6820s laptop

I had a client bring over his laptop saying that the sound was really quiet, even with the volume pumped up to the max!! Then he said perhaps it's because there is only sound coming from one speaker. I thought that one speaker had gone so I plugged in some headphones and sure enough both worked and balance shifted the sound from one ear to the other. However on the built in speakers it had no effect. I thought, hmm looks like a mono speaker system, but who makes them now a days?? Well checking the HP site here, confirms stereo mic and headphones but MONO built in speaker, what the heck!! So I guess the moral is always check the small print!!

Thursday, March 13, 2008

Really Simple .NET Remoting Tutorial with VB.NET

So I've seen lots of examples of remoting on the net, this is not a new topic, but for some it can be a tough subject. Add to this the fact that many choose C# and some just want a good old VB sample so here goes for my longest post to date!!!

So what is remoting anyway
It lets you call objects located in different processes and on different machines just as though they were within the same application, much like when you call a .dll referenced by your app.

So you may say we can do this with WebServices, true, but here the requirement is that both client and server MUST reside on the .NET framework. So with the interoperability gone we get much better performance with a little more complexity.

How to go about it: Server side
First thing we have to do is make our class remoteable by inheriting from MarshalByRefObject.

Public Class clsRemoteObject
Inherits MarshalByRefObject

Public Function getRemoteString() As String
Return Now.ToString()
End Function

End Class

Make sure you put this code in a new class library project and call it: RemotingClassLib

This can then be hosted in any of the following:

  • Console (Must be started manually, but simple to administer)
  • Windows App (Must be started manually, but simple to administer)
  • ASP.NET Web App (Limited to HTTP, but you have session state, start up automatically etc)
  • Windows Service (Use Fast TCP comms, Start automatically but can e complex)

The host must then register a channel to accept incoming requests on. This is important! Most problems arise because of mis-configurations between client and server settings.

Now create another project in the same solution called ConsoleHost and chose the console Application type. Type any of these 3 in the Sub Main.

Create and register a TCP channel:
 Dim tcpChannel As IChannel
tcpChannel = New TcpServerChannel("8085")
ChannelServices.RegisterChannel(tcpChannel, False)
Same for an HTTP and now, new to .NET 2.0, IPC
 Dim  httpChannel As IChannel
httpChannel = New HttpServerChannel("8086")
ChannelServices.RegisterChannel(httpChannel, False)
 Dim  ipcChannel As IChannel
ipcChannel = New IpcServerChannel("Server")
ChannelServices.RegisterChannel(ipcChannel, False)

Next, hook up our remote class to the registered channel. Again you can use any of the following.

The type of object instantiation can also be controled in the hosting app:

  • Singleton: Good for multiple calls where server maintains object between calls and also state:
    RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(RemotingClassLib.clsRemoteObject), "MyRemoteObject", _
  • SingleCall: Good to keep overheads down 
    RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(RemotingClassLib.clsRemoteObject), "MyRemoteObject", _
  • ClientSide Activation: Client controls activation and recieves a dedicated object.
    RemotingConfiguration.RegisterActivatedServiceType(  _

That’s all for now on the server side, now to the calling client!

The Client Side
Here we must reference the Classlibrary that contains the class we wish to instantiate. Oh you say, that kind of negates the whole point because this will take a local copy, then if we update the class library we have a problem. Yes you are absolutely right but what you should do is create an interface in a separate assembly. Then implement that interface in your class library, after setting a reference to the interface library. Then you get the client remoting app to reference the interface also. This way your implementation code is not copied to the client. I’ll tweak the code at the end of this article, but for now let’s keep it simple. So with the reference we can instantiate the object, all we need is a line to redirect calls to methods on this object to the remote object, easy:

Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load

RemotingConfiguration.RegisterWellKnownClientType( _
GetType(RemotingClassLib.clsRemoteObject), _

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

Dim rs As New RemotingClassLib.clsRemoteObject
Me.Text = rs.getRemoteString()

End Sub

That’s it !!!!

Refactor!™ for Visual Studio® - Refactoring support for VB.NET at last

Well C# has had it since 2005 and VB still does not have it. However here is a way to get some of the goodies until it gets added as part of the standard IDE. This is the free version and it has some good stuff. Be sure to register to get the bonus free refactoring goodies. No quite the same as C# but it's a start. If you want the works, the go to the PRO version, ( or C# :) )

Friday, March 7, 2008

Getting ready for Silverlight 2.0 - Part 1

The Silverlight 2 Beta 1 is here. It now includes support for mobile devices and is another step towards helping developers create Rich Internet Applications (RIA). Silverlight 2 includes a cross-platform, cross-browser version of the .NET Framework, and enables a rich .NET development platform that runs in the browser. Developers can write Silverlight applications using any .NET language now (including VB, C#, JavaScript, IronPython and IronRuby) as opposed to having to learn JavaScript as with previous versions. WHat's more it does not require the .NET Framework to be installed on a computer in order to run. The Silverlight setup download includes everything necessary to enable all Silverlight features on a Mac OSX or Windows machine.

So let's get things started:
  1. Install the .NET Framework 3.5 (if you have VS2008 this is not necessary, you have it already) first before you install Expression Blend 2.5.
  2. Install Silverlight 2 Beta 1
  3. Install Expression Blend 2.5 March 2008 Preview (25 megabytes)

My next post will take you through creating you first project.

Customising the WebService Help Page

I remember someone asking this question when I was in a course a long while back and the trainer had said, yeah it can be done,but he didn't tell us how :)

So some years later I'm gonna show you how.

The trick is in the Web.Config. Inside System.web you can set up a WebServices Tag and then include a wsdlHelpGenerator Tag to place your settings. Some options are now available:

Turn of ALL WSDL and Help!!
<remove name="Documentation"/>

Or you can point it to your own file:
<wsdlHelpGenerator href="Default.aspx"></wsdlHelpGenerator>

But like this you have to do the whole page again yourself, there must be an easier way to just add some custom bits like a compnay logo, contact details etd, well there is. If you dig around, %Windows%\Microsoft.NET\Framework\v2.0.50727\CONFIG you'll find a file called DefaultWsdlHelpGenerator.aspx. Now you know what you have to do: Copy it and customise it :) if you want just your webservice changed, or alter it to alter all WebService DOcumentation across the whole machine!!

Adding a WebReference to a Windows Forms Application in VS2008

I'm on a blog posting frenzy this week, since I'm not training :) What with country elections rapidly approaching this weekend!!

So adding a webreference was very straight forward in VS2005, just right click the project and select Add WebReference.

In VS2008 it is still easy if you are making the reference from a Website ASP.NET app, but try and do it from Windows!!! This is usually one of my favourite demos to show how VS makes it so easy for a windows forms to consume data server across the web. Well we all know that SOA is upon us and so the asnwer is in just that. Ideally we would have a WCF app to consume, not the Webservice directly.

We could go down this route but I will save that for another post ;) To do it the 'old way' we start with a right click on the project and select Add Service Reference. You should now see a new window like this.

Two options exist: The WS way or the WCF way.
  • Clicking Discover will find the Webservice in the solution and create a Service reference that must be consumed via the WCF route.
  • The other way is to click Advanced at the bottom and then select WebService. The rest should be very familiar!!

    What's really interesting is that fact that once you have one WebService Reference you can now do it the old way!!! Right click and you get the image below !!

Wednesday, March 5, 2008

Thank you ProcessMeNtOR for the Bottle Warmer!!

I've been meaning to post this since I got back from Barcelona! These cool thermos beer bottle coolers are great at keeping our baby's bottles warm for atleast 4 hours!! My wife loves them and wants more!! :)
Thank you ...

Creating a One-Way Webservice to improve responsiveness

By default a call to a webmethod will wait for the webservice method to complete the whole webmethod, even if it does not return a value. Now you could invoke the method Asynchronously, but considering you don't care what comes back, because nothing its gonna come back why bother? Well let's see how you can make the method one way, so processing resumes on the client straight after the call to the method. Consider the following:

<SoapDocumentMethod(Oneway:=True)> _
<WebMethod()> _
Public Sub Oneway()
End Sub

<WebMethod()> _
Public Sub Twoway()
End Sub

And then we would call theses like this:

Dim proxy As New localhost.Service()
Dim dtStart As New Date
dtStart = Now
MessageBox.Show(DateDiff(DateInterval.Second, dtStart, Now))
dtStart = Now
MessageBox.Show(DateDiff(DateInterval.Second, dtStart, Now))

When you run the code the one way method returns instantly, no delay, the two way will wait 10 seconds and stall the client app!!

Using Session State in a Webservice AND calling from a Windows Form

So setting up a WebMethod to use Session is not that difficult:

<WebMethod(EnableSession:=True)> _
Public Function HelloWorld() As String

If Session("FirstCall") Is Nothing Then
Session("FirstCall") = Now
End If

Return Session("FirstCall")
End Function

And calling this from a webform is not a problem since the browser can handle session information in a cookie etc. However it gets just a little tricky when you call it from a windows form because it has no idea about cookies. So you have to take care of it in the call like this:

Private Cookies As System.Net.CookieContainer

Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click

Dim proxy As New localhost.Service()
' Set the Cookie Container on the proxy
If Cookies Is Nothing Then
Cookies = New System.Net.CookieContainer()
End If
proxy.CookieContainer = Cookies

End Sub

A great explanation can be found here:

Caching a WebService Call

<WebMethod(CacheDuration:=10)> _
Public Function HelloWorld() As String
Return "Hello World" & Now
End Function

The duration is defined in seconds.

Tuesday, March 4, 2008

devNET Malta is now a member of Culminis

A few days ago our Maltese .NET Developer Usegroup was accepted as a member of Culminis.

Culminis is an international not-for-profit organization devoted to the development and growth of the IT community. After supporting and connecting professional user groups and associations, student organizations, and solution providers for more than two years we have come to understand the goals and needs of each group, as well as the resources they have to share. With this knowledge we are developing programs that ensure a meaningful and equitable exchange of those resources, ultimately elevating the status of the IT Pro both in their industry and in the community.

This is a greatopportunity for us to contribute globally to .NET development as well as allow us to benefit from the support of a global network of IT professionals that share our same goals... To make IT Fun!!

Cannot reply to email through Outlook Web Access (OWA) on Windows Vista

Just had a call this morning form a client that was trying to reply to email through the SBS 2003 Outlook Web Access Client. The thing is on Windows XP all works OK and Internet Explorer 7 is installed on both machines. Now after suggesting Firefox as a quick fix I dug deeper. It seems that Firfox will use OWA basic mode by default and so the problem would appear Client side or browser based. However this is not true, it's actually Server side. Exchange uses ActiveX that will not work on Vista. So you have two choices:

  • Work in Basic mode in IE7 or Firefox and lose some of that great Webclient interface or

  • Install the this MS fix to use iFrames on the exchange server!!

Monday, March 3, 2008

Alias a namespace/library in C# with Using;

Just a quick tip on how to make your code a little shorter... and yes this is my first C# post :)

Have a look at the using directive help on the MS site here.

This allows you to turn this:
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();

into this:
using myData=System.Data.SqlClient;

myData.SqlConnection = new myData.SqlConnection();

This is much moreuseful when you have to work with smo in Microsoft.Server.Management.Smo!!!!

Big thank :)

Just wanted to drop a BIG THANK YOU to everyone who visits my blog and also those that leave comments. The hit stats are looking quite respectable now, almost 2000 a month is not too bad!! I will do my best to boost my input over the next few months with more on VS 2008 and most especially Silverlight. So please keep coming back :)

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed.

I was removing WinXP clients from a domain and then joining them to a newone the other day and came across this error:

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.

My leaving the domain was fine, it was the joining the domain that was the problem. However I had failed to read the message, I still had mapped drives to the shared folders on the old domain with the same user nameand folders. So I quickly disconnected the shares and the joining to the domain was instant!! I could then remap them all again.

Moral of the story: READ THE ERROR MESSAGE!!! They sometimes make sense :)

Friday, February 29, 2008

Heros Happen {Here} : Virtual Launch!

Yesterday was a great day for Microsoft and for some MCT's!! We had the chance to participate in a 24hr Virtual launch that was seen by people all over the world. Starting on Wednesday 28th Feb at 12 pm PST, Steve Ballmer launched a new wave of products that would dramatically change the way software developers go about their work. His keyote was supplimented with the kick off of the 24hr virtual launch presented by about 20 MCT's from around the world who delivered a 1hr session through live meeting that was free to attend and repeated 24 times!! The recorded sessions can now be viewed again and there is still the chance to get a two hour free online virtual clinic form here too. Scroll down the page for the live meeting recordings. If you didn't get the chance to attend you can also download the slides for the event too.

Wednesday, February 27, 2008

The image file E:\en_SQL2000_Ent_64bit_VL\setup.exe is valid, but is for a machine type other than the current machine.

Just setup a Windows 2003 R2 Server 64bit and then tried to installed SQL Server 2000 64bit edition. Unfortunately I was greeted with this error:
It turns out that this version of SQL server targeted the Itanium 64 processor, where as this server was a Xeon. So it seems I will have to deploy SQL 2000 32 bit edition and make sure to apply SP4 !! The installation cannot be carried out from the autorun, but has to be run from the x86\setup directory.

Friday, February 22, 2008

Windows Vista SP1 for x86 and x64 is here!

Yes Microsoft have released SP1 for Vista. I downloaded it today on DVD for x86 and x64 thru the MSDN site. There is a great 53 page document what has changed with this release, hopefully I'll have time to read it and blog it!! If I don't the link is here. There is also some info on the TechNet site here. Once I installed it I just had to take these two screen shots.

I dig the the caption in this one:

Monday, February 18, 2008

Project 'SilverlightProject1' could not be opened because the Microsoft Visual Basic 2008 compiler could not be created. Unable to find required file

I've been working fine with Silverlight under my VS 2005 installation but recently I said I'd start doing that work in VS2008. So I installed the Silverlight tools for VS2008 and found a nice new project template for Silverlight projects and class libraries. I clicked it and got a nice Error:

Project 'SilverlightProject2' could not be opened because the Microsoft Visual Basic 2008 compiler could not be created. Unable to find required file 'mscorlib.dll'.

So I hunted around the web and ended up on ScottGu's blog, surprise:) Some said ditch VB.NET and use C#. Sure enough the C# project worked fine, grrrr. So I uninstalled Silverlight 1.0 and tried the Silverlight 1.1 alpha September refresh. Guess what all is OK. Works a charm in VB.NET.

Accessing resources in a non-typed way in VB.NET

OK so the my namespace is really cool, but sometimes we just want more!! to get at a string in the resources of an app is easy. Go to the project tab, add astring resource with the name CompanyName and then type the value in the field nextdoor. Access the value in code like this

label1.text = My.resources.CompanyName

Now intellisense haspicked up the strongly type property and helps you. The same works for images, add an image to the resource file, browse for it and name it Image1. The following code also works:

Picturebox1.Image = My.resources.Image1

Note no need for the extension and also the intellisense pops up again. You just have to love this!!

So now you want to load a random file from the resources, like a random picture..... hmm this strong typing is getting in the way now grrrr.

Do not fret use the resourcemanager, this lets you get to any resource in the current assembly using a string paramater with its name. YES

So imgine you have 10 pics, called 0.jpg, 1.jpg, 2.jpg etc and you want to load them randomly

so the code now looks like this

Dim intNumber as integer = System.Convert.ToInteger(Math.rnd() * 9 )
Picturebox.Image = CType(My.resources.ResourceManager.GetObject(intNumber), Image)

You can also call the GetString method to pull strnig resources in an untyped fashion!!

Friday, February 15, 2008

Web Parts common Error when getting started

A common error many ASP.NET 2.0 beginner developers make is that when they decide to get into WebParts they drag a WebPartManager on the screen and a WebPartZone and then bung in a control. To their dismay, when they press F5 to run the program they get a nasty error like this:

Error:Server Error in '/WebSite1' Application.--------------------------------------------------------------------------------
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error:

Now this error may appear completely unrelated and confusing but it makes sense when you know why ASP is complaining. Basically the WebPartManager is trying to contact the profile store to save your persoanlisation settings, which happen to default to SQLServer by default. Now your app is clean and you have not specified anywhere that you wanted to SQL as your profile storeor perhaps you don't have SQL even installed. So to get around this just switch off the webpartmanager personalisation by setting its personalisation attribute to false:

<asp:webpartmanager id="webpartManagerSampleSite" runat="server" enabled="false"></asp:webpartmanager>

Friday, February 8, 2008

Windows 2008 Server RTM

It's here, yes 18 days before the 2008 Global Launch Wave, three versions have been RTM'ed and are now available for download to MSDN subscribers:
  • Standard Edition,
  • Enterprise Edition and
  • Datacenter Edition.
All are available in x86 or x64 versions :)

The x86 version is a 1794 MB download. As you can see I couldn't wait to get it installed and try it out!!
BTW, the virtual machine had 800MB of RAM and installed in about 15-20 minson a Core2Duo 2.4Ghz HP laptop. The Hard Disk now occupies 5.7GB of space :)

Saturday, February 2, 2008

ASP.NET 2.0 Dynamic master page switching

I've been delving into master pages this week and found some really neat features that alot of people often ask for. This I think is one of them. In the next three steps I show you how to allow the user to switch masterpages. Basically the idea hinges on the fact that the masterpagefile property of a page can be switched at runtime, but it has to be done in the preinit event of the form with the content. The users selection can be stored in any session management storage. So here are the steps:

  • Create two or more master pages with the same ContentPlaceHolder controls and public properties. These could be straight copies or better still two child masters based on the same masterfile
  • Optionally, provide a way for users to switch between master pages.

Session("masterpage") = "Master2.master"


Assign the master page in the content page’s Page_PreInit method.

Sub Page_PreInit(ByVal sender As Object, ByVal e _ As EventArgs)

If Not (Session("masterpage") Is Nothing) Then

MasterPageFile = CType(Session"masterpage") ,String)

End If

End Sub

Tuesday, January 1, 2008

1st European Silverlight Challenge

Thanks to my good friend Daniel Joskovski in Macedonia I am proud to say that Malta will be hosting the 1st European Silverlight Challenge on a country level. The winners of this will go through to compete on a international level against other European finalists. The aim is to develop a Silverlight Web Component that can be GPL'ed for use by other Usegroups. To participate please direct your browser to our site at: Here you will find all the info you need to enter the competition, what you need to do, the rules, and of course the prizes (or SWAG as they say in the UK)!!! The deadline is the end of this month for submissions so hurry. I'm telling you the prizes are cool, so hurry!! As a bonus, the devNET user group will be holding a Silverlight presentation to help you get started. Details can be found here: