VB6 to VB.Net Retains VB6 Appearance

JDYoder

Centurion
Joined
Nov 18, 2003
Messages
144
I upgraded a simple VB6 app to VB.NET. It worked fine, but I found something odd. In the IDE, the controls (buttons and textboxes) look like they normally do in VB.NET. But when I run the program, they take on the VB6 appearance (square cornered buttons and shaded textboxes). This still happens if I add a new form into the newly converted project and add new controls onto it.

How can I make all the controls (converted and newly added) in a converted app appear like they do with a brand new VB.NET app at run-time?
 
Visual styles

I believe there are generally two ways of enabling visual styles - via a manifest file, or programmatically. I prefer the latter approach. In the Sub Main add the following line of code before any forms are shown:

Visual Basic:
Application.EnableVisualStyles()

This will enable visual styles for the application. If you're interested in the manifest approach, a search will probably yield some useful information.

Good luck :cool:
 
Your post enabled me to find a better way to correct this. You mentioned it's at the app level, so I checked the project's properties. In the Application tab I saw "Enable XP Visual Styles" was checked, but grayed out. So I checked "Enabled Application Framework" above it and presto, it works! (I found that when making a new VB.NET app, that's automatically checked.)

So thanks for your help! It was driving me nuts!
 
Are you running 2005 version? 2003 I don't think has that as I looked around so I have to do what MrPaul said and also have to set the FlatStyle properties to "System", If I want to. But since we are still on Windows 2000,:mad: it doesn't work on it.
 
Back
Top