Multiple forms - can't get them to work

pacbob
12-28-2004, 05:16 PM
Converted a large project with multiple forms/dialogs from VB6 to VB.NET.
The forms in VB6 were called with "Formx.show" and closed with "Formx.hide".
In navigating between forms, I would simply show the next form and hide the current one. Worked great.

VB.NET did a lot of form conversion work for me but when I run the converted code the forms do not show and when the start up form is hidden, the whole app seems to shut down or else it just goes into hibernation with no messages.

To try to find the problem, I created some new forms from scratch and then copied the code into them. With some effort I was able to get the first couple of forms to work. I seem to have to use "Formx.showdialog" rather than "Formx.show" and not sure why.

Further, I tried to then use the third form as converted by .NET and the program just quietly closes and goes away when I call the third form, no matter whether I use .show or .showdialog. MS Help not very.

I can upload some of the code but there is so much going on in the "conversion" section that I am hesitant about doing that.

I'd rather not edit out all the "conversion help" I received from the converter.
Any suggestions appreciated.

:confused:

Mike Rosenblum
12-28-2004, 08:54 PM
More or less, .Show is "modeless" and .ShowDialog is "modal". I donít know about the VB6 Conversion Wizard, but I'm not surprised that it "chokes" on a large, complex project.

What I would do is start small project, if only just for testing purposes. Make a brand new Windows Application and add only two forms. Then have the first form call the 2nd one and see if you can get this simple test to work the way that you want. By cutting the problem down to size, you have a much better chance of figuring it out.

If you still get stuck with the small example, then show us your code and we'll see if we can help. :)

pacbob
12-29-2004, 07:35 PM
Mike, thanks for the response.
I tried that already and it worked ok. I can start up from a Sub Main in a module and navigate to 3 other forms and navigate around between the forms with different buttons. I do have to use .showdialog to get the form to be visible. Regardless of what I try, .show does not work.
The first form starts with .show but it is started from sub main and is purposely created to be invisible.

So in general I can probably get it to work.
What I was trying to avoid was editing every form to take out the conversion stuff and change all the form calls that were created as:
"myform.DefInstance.Show" which does not seem to work.

Thoughts?
:huh:

Mike Rosenblum
12-29-2004, 08:02 PM
I wouldn't rely on the VB6 --> .Net conversion code at all, to be honest. I would look at it as a guide, but, well that's about it. Beyond that, be prepared to rip out any of it -- and possibly all of it. If it's a huge project that largely works, then, ok, maybe you don't want to rip it all out, but in time, I suspect that you will wind up redoing most or even all of it.

As for a quick fix, here, I don't know why .Show() would not work, but could you show a Sub or Function that is using .Show() and failing? Actually, since this seems to be occurring for you even within your small test Assembly, could you .Zip that up (without the EXE's) and include it here so we could kick it around?

surge
12-31-2004, 10:00 AM
i'm not quite sure what your talking about, but try this:


Dim Open As New Form2
Open.ShowDialog()

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum