Leaders dynamic_sysop Posted October 8, 2002 Leaders Posted October 8, 2002 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:-\ Quote
*Gurus* divil Posted October 8, 2002 *Gurus* Posted October 8, 2002 Dim X As New frmTrace() X.Show() Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Leaders dynamic_sysop Posted October 8, 2002 Author Leaders Posted October 8, 2002 hey thanx that works great, how come there's no more frmTrace.Show? Quote
*Gurus* Derek Stone Posted October 8, 2002 *Gurus* Posted October 8, 2002 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. Quote Posting Guidelines
Leaders dynamic_sysop Posted October 9, 2002 Author Leaders Posted October 9, 2002 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 Quote
Leaders dynamic_sysop Posted October 9, 2002 Author Leaders Posted October 9, 2002 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 Quote
Leaders dynamic_sysop Posted October 9, 2002 Author Leaders Posted October 9, 2002 hey i'm gettin there:) Dim x As New frmTrace i put in the forms code at the top, then in the menufrmTrace_click i put x = New frmTrace() x.Show() this has fixed the problem :) Quote
*Gurus* divil Posted October 9, 2002 *Gurus* Posted October 9, 2002 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.