showing a second form in .net?

dynamic_sysop

Senior Contributor
Joined
Oct 1, 2002
Messages
1,039
Location
Ashby, Leicestershire.
hi could anyone shed some light on how to show a second form in .net plz? in vb6 i'd have something like
Public Sub ShwfrmOps_Click()
frmOps.Show
End Sub

i notice that if i merge a project from vb6 it says frmOps.Definstance.Show but there is no option for this when making a new project in .net, i am rebuilding a totally new client using .net rather than just merging from vb6 as this wont teach me much. basically i'm making me new chat client and going to release a vb6 version and a .net version as the listviews r very good in .net and allow most of the current font characters to show where as the listview / comon control in vb6 shows many characters as ??'s
on my client i have various option forms for example a frmData which shows the server trace on joining etc... now i cant for the life of me find a way to show this form when connecting my client, i click the button and nothing happens, i've tried frmTrace.ActiveForm.Show and a few other ways but nothing:-\
 
FrmTrace is a class, not an instance of the class. .NET doesn't support default form instances as VB6 did, so therefore you have to create an instance of the form manually.
 
ok that code shows the form no probs, but if i close the form then try to re-open it ,it crashes and says cannot open a disposed form, so i tried doing stuff like hide etc... and close within the frmTrace closing and from onclosed and the dispose sub but nothing
 
An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll

Additional information: Cannot access a disposed object named "frmTrace".

thats the exact error code, i have to have Dim x As New frmTrace() at the top of the form because i need x.Raw.SelectedText in 3 subs " ocx.DataArrival , Server1 and Server2", if i put Dim x As New frmTrace in the menuTrace_click it will open and close the form without fail but the serverdata never shows in the x.Raw , however if i only do Dim x As New frmTrace at the top of the form it shows the server data, but then once the form is closed it wont re-open, seems to be going round in circles
 
I'm glad you solved your problem, but don't forget you don't need two New assignments. You could probably get rid of the New from your declare at the top of the form code.
 
Back
Top