tags:

views:

192

answers:

3

Hello Techies,

In my vb.net project i have two forms names are emp and admin. Even i set startup form as emp it always load admin.Kindly help me to solve this problem.

Thanks and Regards Alagar [email protected]

A: 

Go Solutions Explorer. Click on your project. Go to project properties. Look for Startup Form. Click admin.

Make sure when you build your project, you're not having any compile/build errors. If you are, it will ask if you want to run the last successful build. Never answer "Yes" to that question. Instead, solve your compile errors and run it again.

EDIT: If you've tried it thru setting the startup form and there are no compile errors, then as a last resort, you can try the brute-force method.

  1. Create a new static method to your project. Call it, say Startup().
Public Sub Startup()
    admin.Show()
End Sub
  1. Go to My Project in Solution Explorer.
  2. On the Application tab, uncheck Enable Application Framework.
  3. Now in the dropdown above, you'll be able to see your Startup() method. Choose Startup().
  4. Save, build, and run.

You'll see whatever form you want in the code. This is fool-proof.

Rap
hi Rap, Thanks for your answer. While i setting startup form as admin it working. but while i set emp as startup form it is not working it loads admin.
Mayan Alagar Pandi
hi Rap i did not encountered any error while i build my application
Mayan Alagar Pandi
A: 

If the code in the form emp accesses anything in the admin form (class), it will cause the admin form to be loaded.

xpda
A: 

From project properties, select the startup form. And if it doesn't work, find "application.designer.vb" file.

<Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
        Protected Overrides Sub OnCreateMainForm()
            Me.MainForm = Global.AssemblyExample.<<form name >>
        End Sub

<<form name>> is the one which you want to set as a startup.

Vijay Balkawade