form cannot be designed

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
Hi,

I have a strange problem. I designed a form and then added some functions to the class. But when I try to open the design view of the form, I get the following error:

The base class 'System.Windows.Forms.Form'cannot be designed

Can anybody help me with this please?

Thanks,
El Loco
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Did you acidently remove 'public class form' from the top?

TPM
 

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
I'm affraid not... Also the "Inherits Windows.System.Forms.Form" statement is still where it's supposed to be. (That is the only cause for this error I could find).

The strange thing is the code doesn't give any error when I compile it and the form is loaded and shown! But I can't design it anymore... :(

Greets,
El Loco

Here is part of my code:

Imports System.Data.Odbc
Imports System.Data.SqlClient
Imports System.Windows
Imports System.Windows.Forms

Public
Class Form1
Inherits System.Windows.Forms.Form

Dim blnError AsBoolean
Dim db As DataBase
Dim strCmd AsString
Dim dr AsString

PrivateSub btnTest_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles btnTest.Click

db = New DataBase()
db.OpenConnection()

strCmd = "SELECT * FROM tbl_USR_User WHERE USR_ID_PK = 1"
dr = db.ExecCommand(strCmd)

txtTest.Text = dr
EndSub
EndClass
 

Schenz

Well-known member
Joined
Sep 11, 2004
Messages
181
Location
Cincinnati, OH
Programming Experience
5-10
I would also check to make sure you didn't accidentally change anything within the #Region " Windows Form Designer generated code " section of code.

Are you using VS.NET or another IDE?
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Is the problem project specific? ie if you start a new project can you use the designer?
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
i remember my vb2003 teacher saying something about vs2002 haveing a lot of problems with the disgner and stuff (that's why our college is useing vs2003 too ) but i dont remember anything specific or how to work around the problem
 

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
I'm indeed using VB.NET 2002 and VS.NET 2002 as my IDE. At home I use VS.NET 2003. I think the 2003 version is indeed much better, but when I was installing nobody had the 2003 version. I have it at home, but only on DVD and not on CD. And the laptop I'm working on till I get my own hasn't got a DVD player :( I'll just have to wait until I get my own laptop, then I'll install VS 2003.

The problem is not entirely project specific. When I start a new project, it all works fine. But after a while it doesn't work anymore. I didn't change anything in the code produced by the form designer, except I added a statement that calls my init() function to read some variables from a config file. But I had the problem several days before I did that...

I guess I'll just have to keep pushing my boss for that laptop! The laptop I'm using now has only a 5GB harddisk. That's not even enough for the MSDN (would take up all of the space left on my disk).

I'm going to try my project on my computer back home this weekend (with VS 2003) to see if that solves the problem. I bet it does :rolleyes:

Greets,
El Loco
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
JuggaloBrotha's probably right, I wouldn't be at all supprized if it was a bug, after all it's a 'new' microsoft product... :)

FYI : If you run it on 2003 your project will be updated to .net 1.1 (2002 uses 1.0) and will nolonger work on your laptop.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
TPM said:
JuggaloBrotha's probably right, I wouldn't be at all supprized if it was a bug, after all it's a 'new' microsoft product... :)

FYI : If you run it on 2003 your project will be updated to .net 1.1 (2002 uses 1.0) and will nolonger work on your laptop.
actually both vs2002 and vs2003 uses .net 1.0 (1.1 was released after vs2003, but only by a month or so), at least my full copy of vs2003 is on the .net 1.0 (our whole college class is), most of us have upgraded to 1.1 though

the "background" to the editors are completely different, a vs2002 project will be asked to upgrade to vs2003 when opened in 2003 (if you dont upgrade, it doesnt work in 2003 anyways, so yes upgrade) it changes the way the *.sln, *.vbproj and *.vb files are saved... the 2002 editor CAN NOT read the 2003 projects so it's a one-way trip

just as vs2005 (.net 2.0) will ask you to upgrade 2002&2003 projects, but it'll be a one-way trip there too...
 

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
Hm, I didn't know that. But I think I'm going to install 2003 on the laptop anyway. 2002 drives me crasy, since I use the 1.1 framework a lot...

One thing I do like about vs 2002 is the way it shows you your errors in the code. (example: You type If and press enter, 2002 highlites the If statement with a blue line where 2003 would give you an anoying error message first...)
Is it possible to change the way 2003 handles these situations?

Greets,
El Loco
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
by default the 2 copies of vs2003 that i've installed does the squiggly blue underlineing (like in msWord) when the code's wrong or contains an error it also addes it to the TaskList in the window @ the bottom, other than that it doesnt bother you at all

also if you type in If BooleanVariable = True Then and press enter, it auto adds (on the next line down) the End If for you... i like that plus the auto-indenting that's nice too, but yes, 2003 is very nice, though i am looking foreard to the actual release of 2005 :)

i dont see a setting for any messagebox prompts when you have a syntax error...
 

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
I didn't have the time to try the project at home this weekend, with christmas and all... So, that will have to wait. But by now I'm convinced it'll work just fine in VS 2003.

Greets,
El Loco
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
JuggaloBrotha said:
actually both vs2002 and vs2003 uses .net 1.0 (1.1 was released after vs2003, but only by a month or so), at least my full copy of vs2003 is on the .net 1.0 (our whole college class is), most of us have upgraded to 1.1 though
Hmm I thought my copy installed 1.1... Maybe I had put it on before the install. 2003 will work with 1.0 but it's targeted at 1.1, and that's what most people use.
 

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
Well, I finally had the time to install VS2003. And guess what. It works fine now!

Thanks for the help!

Greets,
El Loco
 
Top Bottom