In VB...

Nov 6, 2008 at 2:34 PM
How do you initilise the application?

 I understand that in C# you do not need to start anything but the Application (or App) object, but in the settings for a VB applicaiton there is a drop down that is required to be set either to "Sub Main" or one of the .xaml files!

How do I get round this?
Nov 6, 2008 at 3:58 PM
Never mind... figured it out... Add the folowing to your Application class:

<System.STAThreadAttribute()> _

 

Public Shared Sub Main()

 

 

Dim app As New Application()

 

app.Run()

 

End Sub

 

Nov 7, 2008 at 4:49 PM

Hi,

 

To initialize a Composite WPF application in Visual Basic.Net you can follow the steps in this article (How to: Create a Solution Using the Composite Application Library) with a few changes.

 

 Instead of setting the name of the class as $ApplicationName$.$ClassName$ in the .xaml files you only need to set it to the $ClassName$. For example the following code from step 4:

<Application x:Class="CALApplication1.App"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

StartupUri="Shell.xaml">

 

Needs to be replaced for this one:

<Application x:Class="App"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

StartupUri="Shell.xaml">

 

This should load your application after you have finished all steps in the article. This has to be done because when you add a Visual Basic class to a project using the Visual Studio, the namespace is not added by default.

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman

Nov 7, 2008 at 4:56 PM
Actualy, what I stated before works...

Never mind... figured it out... Add the folowing to your Application class:

<System.STAThreadAttribute()> _

 

Public Shared Sub Main()

 

 

Dim app As New Application()

 

app.Run()

 

End Sub