Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run problem

Status
Not open for further replies.

smithbr

MIS
May 29, 2003
85
US
This is my first time using VB.Net, I have always used 6.0. Now, to the question. I have set a a program that is linked to access and pulls up invoice info based on an invoice number that the user types in. I am trying to test run the program to see how it is working and all that happens is a black form window opens...nothing in it....There is all this code in code editor window that says is 'Required by the Windows Form Designer'...I really have no idea what any of the code means or does but it says it is required and I know I did not input any of it..it just appeard when I created the form. Anyone know why I am only getting a blank form window....I hate .net....6.0 was so much simpler
 
Sorry you're having such problems. I'm not a GUI guy (more of a middle-tier person), but what I understand is that under VB6, the VB runtime handled control creation for you in the background. Whenever you instantiated a form, VB would read the form's definition and create all the controls that populate the form for you.

In .NET, everything is an object (even controls), which means that something has to do a "new" on them to create them, and then set their size, location, & other properties in order for them to be placed on the form. That's what that hidden code block is -- it's all the calls to the control constructors and setting various design-time properties.

As you've probably found out :(, you shouldn't mess with that section *and* expect to use the graphical form designer. When you bring the form up in design mode, all those settings get re-written. Back before Visual Studio was released, the early C# coders (using just the command-line compiler) had to write all that stuff by hand, just guessing at the positions of the controls and tweaking it until it looked decent. With Visual Studio you've got it easy, as you can just drag & drop controls where you want. The downside is you can't touch that code block.

I would suggest you start out easy with a sinple form that has a couple of buttons on it. Then gradually build up to your complete form to see how things work in the new product.

Chip H.
 
ok...thanks for the help...but I just opened a brand new form in a new project. I changed the color and added an exit button and that was it...very simple stuff. When I went to test run the app, it said there was a build error: "'Sub Main' was not found in 'Commission.Form1'." Anyone know what is going on and how I can fix this probelm?
 
I am pretty new with working in vb.net, but I have encountered similar errors before. My problem was that I had inadvertently deleted the statement:

Inherits System.Windows.Forms.Form

The statement should be at the top of your code behind your form, right before the windows generated code.

Hope this fixes you up : )
 
In Solution Explorer, right-click on your project. Select Properties / Common Properties / General then select OutputType=Windows Application and select the Start Up Object = your form.

Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top