Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 21st, 2005, 12:56 PM   #11
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
This is Visual Basic .NET - it doesn't work like that.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 23rd, 2005, 11:26 AM   #12
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
In visual basic 6, all forms are singleton. He says it is "already made" because in VB6, when you make a form in the designer you use it without creating a form object.

In VB .Net you have to think of a form as a regular class...the class is made, but the object is not. First you create an object and then call its method. So in this case, you would indeed want to do:

Dim frm as new Form2
frm.Show
Dameon is offline   Reply With Quote
Old May 27th, 2005, 9:15 PM   #13
Wraith Daquell
Programmer
 
Join Date: Feb 2005
Location: Limbo
Posts: 39
Rep Power: 0 Wraith Daquell is on a distinguished road
JaDa64, have you created Form2 yet? In .NET, as has already been stated, you must create a form object before showing it. It sounds whacked, but it's better that way. So say you have the form object, f, you'd call f.Show to show it. It's not tough to do once you've grasped the idea, but it took me months to figure it out (hey, guys, don't laugh too hard over that one... I'm teaching myself... )
If you need any P2P help, just PM or Email me; I'm glad to help.
__________________
The meek will inherit the earth.

-WDaquell
Wraith Daquell is offline   Reply With Quote
Old Jun 7th, 2005, 6:20 AM   #14
Mikeshaw
Newbie
 
Join Date: Jun 2005
Location: glasgow
Posts: 4
Rep Power: 0 Mikeshaw is on a distinguished road
Hi,

Im new to vb.net but i think everyone makes it a lot more complicated than it needs to be, if you have already made the second form in designer then simply put

form2.visible = true

into your button click

Mike
Mikeshaw is offline   Reply With Quote
Old Jul 2nd, 2005, 11:57 AM   #15
║▓ßúdhαrlεy▓║
Newbie
 
║▓ßúdhαrlεy▓║'s Avatar
 
Join Date: Jul 2005
Location: Arizona
Posts: 19
Rep Power: 0 ║▓ßúdhαrlεy▓║ is on a distinguished road
You could create a base form and have the created form be an inherent window that way you can open multiples of the inherent form within one window similar to Excel.

check out this link from msdn they have several walkthroughs and code samples.

http://msdn.microsoft.com/library/de...outoptions.asp
║▓ßúdhαrlεy▓║ is offline   Reply With Quote
Old Jul 2nd, 2005, 1:52 PM   #16
nez
Programmer
 
nez's Avatar
 
Join Date: May 2005
Location: Plymouth UK
Posts: 34
Rep Power: 0 nez is on a distinguished road
Send a message via MSN to nez
I've been trying to do the same thing in Visual c# 2005 express edition (bete), using:

private void button1_Click(object sender, System.EventArgs e)
{
    Form2 frm = new Form2();
    frm.Show();
}

which is that i found on MSDN and is also suggested by someone here (ctor i think), but i get this error code when i compile it:

Quote:
The type or namespace name 'Form2' could not be found (are you missing a using directive or an assembly reference?)
i have created both forms already, any ideas?

Cheers
Nez
__________________
atariboy.wordpress.com
nez is offline   Reply With Quote
Old Jul 2nd, 2005, 9:46 PM   #17
║▓ßúdhαrlεy▓║
Newbie
 
║▓ßúdhαrlεy▓║'s Avatar
 
Join Date: Jul 2005
Location: Arizona
Posts: 19
Rep Power: 0 ║▓ßúdhαrlεy▓║ is on a distinguished road
VB Inherent form

    Private Sub mnuFNew_Click( _
 ByVal sender As System.Object, _
 ByVal e As System.EventArgs) _
 Handles mnuFNew.Click
        Dim frm As New frmDataEntry

        frm.MdiParent = Me
        frm.Show()
    End Sub

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

    End Sub

This is how I did it with VB.net it needs the string Handles which is new from VB 6. This opens the new form by selecting File > New. Also the names will need to be changed to whatever you saved them as. frmDataEntry is the name of the form that opens when you select File > New

Last edited by ║▓ßúdhαrlεy▓║; Jul 2nd, 2005 at 10:00 PM.
║▓ßúdhαrlεy▓║ is offline   Reply With Quote
Old Jul 3rd, 2005, 4:27 PM   #18
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Dameon's right of course

I'd usually do this:

With IForm as New Form2()
.Show()
End With

which just looks a little more elegant.
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:17 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC