Blog

posts by Fons Sonnemans

Free .NET tools

0 Comments
By Fons Sonnemans, 25-aug-2002
I have found some great .NET tools on www.sellsbrothers.com

READ MORE

.NET Framework Service Pack 2

0 Comments
By Fons Sonnemans, 09-aug-2002
There is a new servicepack for the .NET Framework. Goto .NET Framework Service Pack 2

READ MORE

Balloon Windows for .NET

0 Comments
By Fons Sonnemans, 07-aug-2002

I have found a class that allows for balloon shaped forms in .NET.

Have a look at CodeProject.

READ MORE

GotDotNet: Xml WebService Award?

0 Comments
By Fons Sonnemans, 01-aug-2002

What happened with the XML WebServices Award on the GotDotNet website? I have submitted my Html2Xml webserivce. I don't expect to win the 25.000 dollar price, an X-box would be nice :-)

The winners would be announced at the Teched in Barcelona (1-5 July 2002). Then this was moved to July 12. It is now August. Nothing has happened. Is there no winner?

Strange!

Tags: XML, CSharp

READ MORE

WinForm SplashScreen

0 Comments
By Fons Sonnemans, 01-aug-2002

Download SplashScreen.zip

Introduction

Most commercial WinForm applications have a SplashScreen. This article explains how you can implement one using the Microsoft .NET Framework.


Example: Visual Studio.NET SplashScreen


SplashApplicationContext

The SplashApplicationContext is used to show a splash Form before the main Form is shown. It's base class is ApplicationContext.

The constructor accepts 3 arguments

  • mainForm: The main Form of the application to use for context
  • splashForm: The splash Form of the application to use for context
  • interval: The time (in milliseconds) the splash Form is visible. Specify 0 to disable the timeout.

Usage

The Application.Run(context) method creates a standard application message loop on the current thread, with an ApplicationContext.

The following code creates a SplashApplicationContext using a new Form1 as the MainForm and a new SplashForm as the SplashForm. The interval is set to 2000 which will show the SplashForm for 2 seconds. This is done in the static Main() method.

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
staticvoid Main()
{
    SplashApplicationContext myContext=
        new SplashApplicationContext(new Form1(),new SplashForm(), 2000);

    Application.Run(myContext);
}
Code: Form1.cs

You can use the time that the SplashForm is shown usefully. You can use it to connect to databases or do some other intializations. The following code simulates some activity. The status is displayed using a Label control.

private void SplashForm_Load(object sender, System.EventArgs e)
{
    // Show Form
    this.Show();
    Application.DoEvents();// Finish Paint
    Cursor.Current = Cursors.WaitCursor;

    // Simulate some activity (e.g. connect to database, caching data, retrieving defaults)
    this.labelStatus.Text ="Step 1";
    this.labelStatus.Refresh();
    System.Threading.Thread.Sleep(1000);

    // Simulate some activity
    this.labelStatus.Text ="Step 2";
    this.labelStatus.Refresh();
    System.Threading.Thread.Sleep(1000);

    // Simulate some activity
    this.labelStatus.Text ="Step 3";
    this.labelStatus.Refresh();
    System.Threading.Thread.Sleep(1000);

    // Close Form
    this.Close();
}

Code: SplashForm.cs

You must set the interval to 0 to disable the timer.

[STAThread]
staticvoid Main()
{
    SplashApplicationContext myContext=
        new SplashApplicationContext(new Form1(),new SplashForm(), 0);

    Application.Run(myContext);
}

Code: Form1.cs

Conclusion

The SplashApplicationContext class is easy solution to show a SplashScreen. It demonstrates the power of the .NET Framework.

Any suggestions and feedback for improving this article is most welcome. Send your suggestions and feedback to Fons.Sonnemans@reflectionit.nl

READ MORE

C# XML Documentation and NDoc

0 Comments
By Fons Sonnemans, 30-jul-2002

I have found the opensource project/tool NDoc which compiles the C# Xml Documentation to MSDN like help file.

It works great!

READ MORE

VB.NET Bug?

1 Comments
By Fons Sonnemans, 26-jul-2002

I think I have found a Bug in VB.NET (Final)! I can't compile the following program (Build Error: 'Private Function Foo() As Integer' and 'Public Function Foo() As String' cannot overload each other because they differ only by return types. ). It worked in Beta2 of VB.NET.

Public Interface ITestInterface

   Function Foo() As Integer

End Interface

Public Class TestClass

   Implements ITestInterface

   Private Function Foo() As Integer Implements VBBug.ITestInterface.Foo
      Return 1
   End Function

   Public Function Foo() As String
      Return "2"
   End Function

End Class

Tags: VB

READ MORE

Free OutlookBar WinForm control

0 Comments
By Fons Sonnemans, 25-jul-2002

I have found a great OutlookBar control on C# Corner.

READ MORE

Distributed Transactions without COM+ (EnterpriceServices)

0 Comments
By Fons Sonnemans, 24-jul-2002

I don't like COM+. I have never liked it but I had to use it when I needed Distributed Transactions. At the Teched 2002 in Barcelona I learned how you can use Distributed Transactions without COM+.

My problem with COM+ is the fact that you only can choose one transactiontype for a class. You can not differentiate it per method.

Download the following Zip file and have a look at Ron Jacobs example project and slides.

Be carefull, this only works on Windows XP. It uses some lowlevel COM+ 1.5 features.

READ MORE

This is the start of my .NET WebLog

0 Comments
By Fons Sonnemans, 23-jul-2002

I have recently updated my WebSite from 'Classic' ASP to ASP.NET. This allowed me to create this WebLog easily using an Xml file and a DataGrid.

I will use this WebLog as a podium to communicate my personal opinion about Microsoft .NET. The 'product' which allows me to create great software.

Tags: Work

READ MORE

All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.