Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / February 2005

Tip: Looking for answers? Try searching our database.

Making a Startup Windows Form Invisible

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roger Stenson - 26 Feb 2005 22:33 GMT
' Hi all
I have been using the following example from the Dot Net Help screen with
the above title as my model

Sub Main()

  ' Instantiate a new instance of Form1.

  Dim f1 as New Form1()

  ' Customize the form.

  f1.Text = "Running Form"

  ' Show the instance of the form modally.

  f1.ShowDialog()

End Sub

My Code in Sub Main  reads as follows

Dim Signon =As  New frmSignon(_populatelastlogon)    Executes ok

Signon.lstOrganisation.Items.Add("Anything")          System Crashes -
message below

Signon.ShowDialog()

This and any other attempt to address the members of the List Box
lstOrganisation results in the following error message

"A unhandled exception of type 'System.NullReferenceException' occurred in
BRUserInterface.exe

Additional information: Object reference not set to an instance of an
object."

A quick watch on the control produces a  value of Nothing

I would be grateful if some one would tell me how to deal with this issue

Roger Stenson
Joergen Bech <jbech<NOSPAM>@ - 27 Feb 2005 07:52 GMT
This line suggests that you have created your own constructor for the
form:

>Dim Signon =As  New frmSignon(_populatelastlogon)    Executes ok

e.g. something like:

   Public Sub New()
       MyBase.New()

       'This call is required by the Windows Form Designer.
       InitializeComponent()

       'Add any initialization after the InitializeComponent() call

   End Sub

   Public Sub New(ByVal blnTest As Boolean)
       MyBase.New()
       'Do nothing
   End Sub

where calling the custom constructor does not result in a call
to InitializeComponent, which is where your listbox is created.

The fact that the "Text" property can be set in the example
you are working from is because the Form class is derived
from the Control one, which contains a Text property.

But as you did not supply the code for the constructor for
frmSignon(<something>), this is just speculation.

/JB

>' Hi all
>I have been using the following example from the Dot Net Help screen with
[quoted text clipped - 39 lines]
>
>Roger Stenson
Roger Stenson - 27 Feb 2005 18:13 GMT
Hi Joergen
Thank you for your advice and the speed of its delivery. You not only solved
my problem but also persuaded me to read the advanced sections of the text I
am using to convert from VB6 to .Dot Net. I now more  fully understand the
context of your remarks and the differences between the two.
Roger Stenson

> This line suggests that you have created your own constructor for the
> form:
[quoted text clipped - 73 lines]
>>
>>Roger Stenson

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.