?
Solved

VB.Net - Load a form's properties and getting unhandled exception

Posted on 2005-05-12
3
Medium Priority
?
332 Views
Last Modified: 2010-04-17
Starting a new VB.Net project and crashed at first hurdle.

I am getting this error message >>>>

An unhandled exception of type 'System.NullReferenceException' occurred in Test.exe

What am I doing wrong?

And also how can stop the system putting in FormWindowState.Maximized. I just want = Maximised

How could I do this in a module rather than at form load?

***********
Private Sub frmMainMenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Setup the frmMainMenu properties
frmMainMenu.ActiveForm.WindowState = FormWindowState.Maximized
frmMainMenu.ActiveForm.IsMdiContainer = True
frmMainMenu.ActiveForm.Text = "Main Menu"

End Sub
0
Comment
Question by:directred
  • 2
3 Comments
 
LVL 2

Expert Comment

by:kouroshparsa
ID: 13989893
You can set it maximized in the GDI of the form (easily)
or set it's state to maximized when the controls on the form are defined. Why in the module for God's sake?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 150 total points
ID: 13998592
>>And also how can stop the system putting in FormWindowState.Maximized. I just want = Maximised

Add this line to the top of the form module:
  Imports System.Windows.Forms.FormWindowState

Bob
0
 
LVL 2

Expert Comment

by:kouroshparsa
ID: 14108952
To the author: If you want to ask questions and ignore some correct responds, this is not a forum for you!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Six Sigma Control Plans

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question