How Does the object.Show() event work in VS2010 (VB.Net) work

Posted on 2013-01-14
Last Modified: 2013-01-15
I am not a trained programmer but have learnt on the job with VB6 (and other languages) .  I supervised the writing of and have modified a VB6 enterprise program over the last 15 years.  It is still currently in production and but can no longer be supported in the direction the company is moving.  OS upgrades are slowly killing it.

I converted the program to VS2010, and whilst I can fix most control issues am having problems in displaying called forms from the mdiform that is master form for the program.  I had to recreate the mdiform from scratch to ensure it worked OK. (Just menubar, toolbar and status bar controls.)

Normally in VB6 when I hit a .show()  event I was able to step into the called form and step through the code, however in VS2010 when I hit the event, no form is displayed and often as not the mdi form also shuts down.

When I recreate a form in VS2010 it sometimes can be shown but again a 50-50 success rate.  Can someone explain to me how the show() event works as not much sensible information on the internet.  Is there some simple solution to showing the called forms as I have 77 forms to recreate  an 98 CR reports to re-engineer?   Or would praying be better?

I have not attached any code yet as the data is too big.
Question by:Warwick_Radford
  • 2
LVL 83

Accepted Solution

CodeCruiser earned 500 total points
ID: 38774044
Show() is a method. Its a builtin method of the Form class so if we don't know what it does behind the scenes (unless we dig into it). Do you get any errors? Do you have any code in Load or Shown events of the child forms?
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 38774277
"I converted the program to VS2010"

The converter is awful, and doesn't always work correctly.

Start with a NEW project and manually create the events, copying over code to the correct places (and changing things as you go).

The Show() method works exactly as you'd expect.  It is most likely just a "corrupt" project from the conversion.

Author Comment

ID: 38777306
Reply to both CodeCruiser and Idle_Mind.
Thank you both for answering.  It may be best and start a new project as it could be something wrong in any one of the forms that is affecting the viewing of any one particular form. I understand that.  I just thought that I might be able to get an idea how the show event worked that might make it easier to quickly fix each form. I now know that that was wishful thinking.   It may take too long to debug especially when using the backwards looking features of VS2010 and probably quicker to generate a brand new project.  I will have to bite the bullet and be a little later getting the software to client.
For Code_Cruiser:-  Normally I wouldn't get any error message, the called form just doesn't show and then the mdi form will shutdown.  This suggests to me that there is an internal corruption in the core of the converted program thus I may be better creating a new project.  If I did get any errors it was "Win32Exception was unhandled: Error creating window handle."
MSDN explanations of this error were virtually non-existant and the web not much better.
I think it may better to generate more code.  At least I dont have to recreate the 300 or so stored procedures that go along with this program.  Once again thank you both for your responses.

Author Closing Comment

ID: 38777307
Sorry CodeCruiser  and Idle_Mind.  Should have answered through this method and not as a response.  Tried to accept both answers but trying to do them one at a time.  First time in this forum.  Will do better next time.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SLMGR Switches Are Not Working On KMS Host 3 63
Library to convert HTML to PDF. 8 55
Getting multiple values from a dataset ASP.NET(VB) 3 37
DataGridView Events ? 3 37
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
A short film showing how OnPage and Connectwise integration works.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now