![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
This is Visual Basic .NET - it doesn't work like that.
|
|
|
|
|
|
#12 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#13 |
|
Programmer
Join Date: Feb 2005
Location: Limbo
Posts: 39
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#14 |
|
Newbie
Join Date: Jun 2005
Location: glasgow
Posts: 4
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#15 |
|
Newbie
Join Date: Jul 2005
Location: Arizona
Posts: 19
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#16 | |
|
Programmer
|
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:
Cheers Nez
__________________
atariboy.wordpress.com |
|
|
|
|
|
|
#17 |
|
Newbie
Join Date: Jul 2005
Location: Arizona
Posts: 19
Rep Power: 0
![]() |
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 SubThis 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. |
|
|
|
|
|
#18 |
|
Expert Programmer
|
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|