Showing posts with label Windows Forms. Show all posts
Showing posts with label Windows Forms. Show all posts

Sunday, October 14, 2007

Startup object must be a form when "Enable Application Framework" is checked.

If you're reusing a form and are trying to make it the main form of an application, and you get this error, ensure that the constructor for the form takes no arguments.

Wednesday, August 15, 2007

Console and Windows Form in the same application

I recently needed to write a program that had an attended and unattended mode:

1. Create a console application in Visual Studio .NET.

2. Use this as a template:

Module Module1

    Sub Main()
        If Command$() = "-winform" Then
            Dim frm As New testform()
            Windows.Forms.Application.Run(frm)
        Else
            Console.WriteLine("this is the console option")
        End If
    End Sub

End Module

Tuesday, July 31, 2007

MDI Application Quick Start

Here's what needs to happen to get an MDI application up and running:

1. Set the form's IsMdiContainer property to True.
2. Create a menu strip for the form.
3. Create a Window menu in the menu strip.
4. Set the menu strip's MdiWindowListItem property to the name of the Window menu.

Always refer to the topmost window with a reference to the main form's ActiveMdiChild property.

When a new child window is created, set its MdiParent property to the main form.