p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Stephens' Visual Basic Programming 24-Hour Trainer (http://p2p.wrox.com/forumdisplay.php?f=621)
-   -   Question on conversion (http://p2p.wrox.com/showthread.php?t=86054)

Davebert December 16th, 2011 10:22 AM

Question on conversion
 
I was wondering if you know why Visual Studio opens an app and says "preparing solution", then finishes up with no other message, and the app seems to run fine? This happens with some practice code taken from on pc to another pc where the source pc runs the pro version and the destination pc is running Express. Maybe a better question would be...when opening a project done in VB.NET 2008 and opening it in VB.NET 2010 and letting the Visual Studio fix or convert it, isn't that a permanent fix if saved?

One other note, I have had some time to get started with the book and video's and the video's have kept me glued to the screen. Great job. I have learned that one should not skip the first few chapters thinking it's old news because they are coming from VB Classic. I initially jumped around in the video's but stopped and started from chapter 1 and will view them all. When I see things that are new I grab the book and research more on the info taken from the video. I have learned new stuff even in the first chapter. I think the compiler gets confused sometimes in your video's because you type so fast it can't keep up! [:D] Did you ever figure out why the compiler will cause you to have to start over yet?

Thanks,
DB

Rod Stephens December 16th, 2011 02:16 PM

Quote:

I was wondering if you know why Visual Studio opens an app and says "preparing solution", then finishes up with no other message, and the app seems to run fine? ... Maybe a better question would be...when opening a project done in VB.NET 2008 and opening it in VB.NET 2010 and letting the Visual Studio fix or convert it, isn't that a permanent fix if saved?
You could try to re-open the project in VB 2008 and see if VB 2010 has made it unopenable. If not, then it might be bending over backwards to maintain compatibility. (I don't know offhand if it does.) It's possible that this is causing the message.

If that's not it, then it may be some sort of configuration issue that you'll probably never figure out. This definitely falls into the category of "if it works don't worry about it." People who try to fix this sort of issue sometimes need to reinstall Visual Studio and rarely the whole system to get rid of essentially harmless messages. (If they don't go insane first. [;)])

Quote:

One other note, I have had some time to get started with the book and video's and the video's have kept me glued to the screen. Great job. I have learned that one should not skip the first few chapters thinking it's old news because they are coming from VB Classic. I initially jumped around in the video's but stopped and started from chapter 1 and will view them all. When I see things that are new I grab the book and research more on the info taken from the video. I have learned new stuff even in the first chapter. I think the compiler gets confused sometimes in your video's because you type so fast it can't keep up! Did you ever figure out why the compiler will cause you to have to start over yet?
I found it quite hard to strike a balance in the videos between talking and typing. I normally type much faster than I do in the videos and I use IntelliSense a lot to generate a lot of code much faster than you could reasonably watch and figure out what I'm doing.

There are a few places where if I didn't do things in the proper order Visual Studio got confused. I blame some of that on it being an early release of that version of Visual Studio. It may have been fixed but I haven't tried to go back and reproduce everything to see if the problems are still there.

Normally Visual Studio doesn't get confused just because I'm going fast. It gets confused because I add something, delete it, and there's some piece left over somewhere in some automatically generated code that later confuses things. Fortunately those occasions are fairly uncommon so it's not usually a huge problem.

BUT here are a couple of tips:
  1. Save your work often. Every time you run a program, Visual Studio automatically saves it so you're okay of you test things once in a while. If you're typing a huge block of code, save manually once in a while.
  2. Save a backup before you make major or risky changes. If you're about to restructure a program, use Windows Explorer to save a copy of the whole project tree just in case. Then if you mess things up too badly, you can get the old version back. You can always delete the unneeded version later. (In many big projects I make a new copy every day just to be safe, and I often make one or more other copies during the day when I'm about to do something confusing.)
  3. Finally once in a while the form editor just gets really messed up. Not too often. In those cases you can either edit the automatically-generated code by hand (which takes some practice) or you can start over. It's worth peeking inside those files once in a while to see how they work just in case, but I'm definitely not too proud to start over on a small program! [:D]

Davebert December 17th, 2011 11:23 AM

Thanks for the response and the tips. I am an avid backup person so I have that covered. [:)] I was more concerned with the "unknown" but like you said, I will probably never figure it out. So, I guess I would just rewrite the code in the 2010 version and eliminate the "unknown" because that would drive me insane if it did in fact produce a bug later (or even if it didn't I might think it did when it was my own bug). And the intermittent crashes are always a possibility...

One other thing...yesterday I ended up with the biggest headache I have had in a long time and I think I figured out what may have caused it. I watched 20 video lessons on my wide screen 1920x1080 monitor and when the viewer is first opened, it is not full screen so I maximize it. The text looks a bit blurry but I figured it would be fine. Anyhow, just thought I would mention it in case it can be optimized in future videos or made for different screen sizes. I ended up connecting the video's through my PC this morning through the DLNA server and can watch the other 19 video's on my 55" HDTV nice and large and clear. Problem solved. :)
Thanks,
DB

Rod Stephens December 17th, 2011 12:02 PM

Quote:

So, I guess I would just rewrite the code in the 2010 version ...
Manual conversion isn't too hard. Open the old project and then create a new one in a separate instance of Visual Studio. Copy the form's size from the old program to the new one. Then copy and paste the controls from the old project to the new one.

Finally copy the code from the old program to the new one. You can usually open the code in the code editor and press Ctrl+A to select all of the code. Then press Ctrl+C to copy it all. Finish by pasting it all. VB (unlike C#) hooks event handlers up to controls by using a Handles clause in the code so they should all be hooked up and ready to go.

Post again and let us know if that removes the mystery message.

Quote:

The text looks a bit blurry but I figured it would be fine. Anyhow, just thought I would mention it in case it can be optimized in future videos or made for different screen sizes.
I'm not sure what options we have there. I made the initial videos and they turned out to be too big to fit on a DVD. I turned them over to a production group who reformatted and compressed them to fit. I don't really know what their options are.

I'll mention it but obviously the real solution is for everyone to get a 55" HDTV [;)]

Davebert December 18th, 2011 12:44 PM

Quote:

Originally Posted by Rod Stephens (Post 279528)
Manual conversion isn't too hard. Open the old project and then create a new one in a separate instance of Visual Studio. Copy the form's size from the old program to the new one. Then copy and paste the controls from the old project to the new one.

Finally copy the code from the old program to the new one. You can usually open the code in the code editor and press Ctrl+A to select all of the code. Then press Ctrl+C to copy it all. Finish by pasting it all. VB (unlike C#) hooks event handlers up to controls by using a Handles clause in the code so they should all be hooked up and ready to go.

Post again and let us know if that removes the mystery message.

Thanks for the info on the copying of the project. I like the fact that VB hooks event handlers up to controls as that will make it easier to do. I ran into what may be the reason I am having trouble with the mystery message. The project I used as an example was what I thought was a simple example. When I tried what you described above I realized the example I was trying to copy has a resource file with a form background image and also has the minimize maximize and exit buttons covering up the stock ones. Are resource files the same between version 2008 and 2010? I found "Resourcer" and had a look and found the image used for the background. That may be the reason for the mystery message. I will try it again and see if I use a plain form but I got carried away looking for a resource editor etc...


Quote:

Originally Posted by Rod Stephens (Post 279528)
I'm not sure what options we have there. I made the initial videos and they turned out to be too big to fit on a DVD. I turned them over to a production group who reformatted and compressed them to fit. I don't really know what their options are.

I'll mention it but obviously the real solution is for everyone to get a 55" HDTV [;)]

Well my eyes aren't like they used to be so I am part to blame. I just realized it's time to finally go to the eye doctor instead of using cheap reading glasses. I need to make the jump from a 1.5 to a 2.0 magnification power and that will help for now. I was also glad to realize the video's were made as .MOV files as my HDTV TV doesn't do Flash. My headache is gone and I am ready to get back to work. The in-laws will be over for the holidays for a week so I will be off dealing with them.[|)]
Thanks,
DB

Rod Stephens December 18th, 2011 05:07 PM

I don't know if resources would cause that problem but it's worth a try. [;)]

Davebert December 19th, 2011 10:53 AM

Ok, more info on my test. I found a few things worth noting. When the app is converted from VS2008 to VS2010 it uses the .NET Framework 4. When I tried to copy the app by creating a new one mine was set at .NET Framework 4 Client Profile. I don't know if this matters but I assume for best results they should be the same. I was getting the 3 following errors with the above setup.

Message 1 Could not find schema information for the element 'supportedRuntime'. C:\Documents and Settings\Dave\my documents\visual studio 2010\Projects\WindowsApplication3\WindowsApplicati on3\app.config 23 11 WindowsApplication3

Message 2 Could not find schema information for the attribute 'version'. C:\Documents and Settings\Dave\my documents\visual studio 2010\Projects\WindowsApplication3\WindowsApplicati on3\app.config 23 28 WindowsApplication3

Message 3 Could not find schema information for the attribute 'sku'. C:\Documents and Settings\Dave\my documents\visual studio 2010\Projects\WindowsApplication3\WindowsApplicati on3\app.config 23 43 WindowsApplication3

So I started over and from scratch and made a new project and changed the compiler to .NET Framework 4 and if I try to run the app with just a form I get the same 3 but they are just noted as "Messages". I checked my pc and I have .NET 4.0.3319 in my Framework folder.

Added:
Error messages after I run the app again are:
Error 4 'Protected Overrides Sub Dispose(disposing As Boolean)' has multiple definitions with identical signatures. C:\Documents and Settings\Dave\my documents\visual studio 2010\Projects\WindowsApplication3\WindowsApplicati on3\Form1.Designer.vb 7 29 WindowsApplication3

Error 5 'Private Sub InitializeComponent()' has multiple definitions with identical signatures. C:\Documents and Settings\Dave\my documents\visual studio 2010\Projects\WindowsApplication3\WindowsApplicati on3\Form1.Designer.vb 24 17 WindowsApplication3

Error 6 'components' is already declared as 'Private components As System.ComponentModel.IContainer' in this class. C:\Documents and Settings\Dave\my documents\visual studio 2010\Projects\WindowsApplication3\WindowsApplicati on3\Form1.vb 37 13 WindowsApplication3

Maybe the test I am trying isn't as simple as I thought? I can send you the project in it's original form as it just a simple lottery picker from PSC.
Thanks,
DB

Rod Stephens December 19th, 2011 01:18 PM

Are you just copying your code and not the automatically generated code? The automatically generated code changes from version to version so this is the sort of error you might get if you try that.

If you copy and paste the controls on the form editor, it should generate new code for them in the newer format.

If this doesn't seem like the right track, send me the project (RodStephens@vb-helper.com) and I'll take a peek.

Davebert December 19th, 2011 01:52 PM

I just created a form of the same size and copied the code from the original form to the new form. I sent you the original project so you have all the info. If it is not a good learning example I will just find a simpler one but you be the judge.
Thanks,
DB

edit: I just started the project from the beginning again and realized it was made in a version prior to VB2008. It converted to the VB2008 just fine though and the problem seems to come when trying to convert yet again to VB2010.

Davebert December 19th, 2011 02:49 PM

Well, I guess it must have been some kind of beginners problem or the way I went about it as I just started with the downloaded app from PSC and opened it with VS2010 and converted it and it works perfect. I must have tried to do a dual convert starting with VS2008 and then went to VS2010 and maybe that is where the problem occurred.

That said, which files do I need to be concerned with other than the project and resource files? Any others that I would need to edit manually like we used to in VB6?
Thanks,
DB

p.s. I better study some more.[:p]


All times are GMT -4. The time now is 04:31 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.