Solved

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

Posted on 2013-01-14
4
322 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

15 Experts available now in Live!

Get 1:1 Help Now