Solved

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

Posted on 2013-01-14
4
332 Views
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.
0
Comment
Question by:Warwick_Radford
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
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?
0
 
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.
0
 

Author Comment

by:Warwick_Radford
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.
0
 

Author Closing Comment

by:Warwick_Radford
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.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 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