-
Form Show
Hello, good day.
I am developing a project in vb.net, I had wrote several in vb 6.0 and I remember that when you want to show a form, you just type:
form1.show
me.hide
Now in vb.Net, I am having trouble with this, firts I donīt know what the error is, it only turns to underlined text, then, I delete the show part to see the properties menu that appears when you put a point, but it doesnīt show the Show() option.
I also read that I can put my log in form as a dialog form, and put the form with the links to the other ones as the Main, but I dont know how to change my forms to do this.
Can anyone help me with this?
-
In VB.NET, a form is a class; you must create an instance of the class (using the "New" keyword) before you may use it. Try this:
Dim frm As New Form1
frm.Show()
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Form Error
Hi, good day.
I did that and when the event is fired the form sends an error:
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
I dont know what to do !!!!
-
A null reference exception usually means that you're trying to use an object that you've forgotten to initialize ("New"). Please post the code that's causing the error (no more than a dozen or so lines).
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Dialog Form
Thanks Phil, It was the "new" word that was missing.
Now I read that I can "start" my solution in a Main form, and use the login form as a dialog, so I am on this now, but I have two text boxes with user and password and a validation boolean function, so, I have to send back to the main sub that the user has been validated, i have a couple of buttons also to "validate" the user.
How do I do this, I mean which control has to be "true" and return the value to the Main sub?
Thanks and best regards.
-
I would probably add a read-only property to the form to indicate whether the user successfully logged in:
Code:
Private Success As Boolean
Public ReadOnly Property IsLoggedIn() As Boolean
Get
Return Success
End Get
End Property
Set the Success variable equal to the result of your validation function. In your main form, check the value of LoginForm.IsLoggedIn().
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
In VB.Net 2005, you can show a form in 1 line
My.Forms.Form1.Show
From help...
The My.Forms object provides an easy way to access an instance of each Windows Form declared in the application's project. You can also use properties of the My.Application object to access the application's splash screen and main form, and get a list of the application's open forms.
Similar Threads
-
By Bill Gaddam in forum VB Classic
Replies: 10
Last Post: 11-06-2007, 11:15 AM
-
Replies: 0
Last Post: 03-17-2005, 11:47 AM
-
Replies: 5
Last Post: 08-31-2002, 07:08 AM
-
By cyrille in forum VB Classic
Replies: 0
Last Post: 06-20-2001, 07:37 PM
-
By Nick in forum VB Classic
Replies: 0
Last Post: 11-16-2000, 10:06 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks