By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

GUI not working

P: n/a
I tried compiling the following source code:

Imports System
Imports System.Windows.Forms

Public Class Form1

Shared Sub Main
Dim f1 As New Form()
End Sub

End Class
I got the following errors:

error BC30466: Namespace or type 'Forms' for the Imports
'System.Windows.Forms' cannot be found.
Imports System.Windows.Forms
~~~~~~~~~~~~~~~~~~~~

error BC30002: Type 'Form' is not defined.
Dim f1 As New Form()
~~~~

I thought my entire stack of libraries was gone, but then when I tried to
compile the following code:

Imports System

Public Class Form1

Shared Sub Main
Console.WriteLine("Hello World")
End Sub

End Class
It compiled and ran perfectly. What have I done wrong? Do I need to change
the syntax of my code or download libraries? Is it that I am not compiling
my code correctly. Please reply soon. Thanks all- Hari.

P.S.
If you wish to reply to me personally (which I discourage), please remove
the x from my e-mail addresses as it only exists to prevent spam.
Nov 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"Hari" <ha***********@yahoo.com> wrote in news:qbudnVgFqoT_7bzcRVn-
rQ@adelphia.com:

error BC30466: Namespace or type 'Forms' for the Imports
'System.Windows.Forms' cannot be found.
Imports System.Windows.Forms


Hmmm, check if you have a reference to System.Windows.Forms.

Maybe your default references are screwed up?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2

P: n/a
> Hmmm, check if you have a reference to System.Windows.Forms.

Maybe your default references are screwed up?


When I type in:

vbc /r:System.Windows.Forms

I get 2 errors reading:

vbc : Command line error BC2017 : could not find library
'System.Windows.Forms'

vbc: Fatal error BC2000 : compiler initialization failed unexpectedly: The
system cannot find the file specified.
If this means that I do not have the libraries necessary to run a GUI
application, could someone please give me a link to where I can download the
SDK. I have already tried one download through MSDN, but it didn't seem to
work. Thanks all.
Nov 21 '05 #3

P: n/a
On Mon, 16 Aug 2004 23:37:47 -0400, Hari wrote:
Hmmm, check if you have a reference to System.Windows.Forms.

Maybe your default references are screwed up?


When I type in:

vbc /r:System.Windows.Forms

I get 2 errors reading:

vbc : Command line error BC2017 : could not find library
'System.Windows.Forms'

vbc: Fatal error BC2000 : compiler initialization failed unexpectedly: The
system cannot find the file specified.
If this means that I do not have the libraries necessary to run a GUI
application, could someone please give me a link to where I can download the
SDK. I have already tried one download through MSDN, but it didn't seem to
work. Thanks all.


vbc /r:System.Windows.Forms.dll

You have to add the .dll
--
Tom Shelton [MVP]
Nov 21 '05 #4

P: n/a

"Hari" <ha***********@yahoo.com> wrote in message
news:YO********************@adelphia.com...
Hmmm, check if you have a reference to System.Windows.Forms.

Maybe your default references are screwed up?

When I type in:

vbc /r:System.Windows.Forms

------------------------^
here you need to specify the assembly name which is System.Windows.Forms.dll
and which contains the namespace System..Windows.Forms.
here's how you need to specify the command (seperate multiple assemblies
with a comma):
vbc /r:System.dll,System.Windows.Forms.dll test.vb
where test.vb might be something like:

Imports System
Imports System.Windows.Forms

Public Class Form1

Shared Sub Main
Dim f1 As New Form()
f1.Width = 300
f1.Height = 300
f1.ShowDialog()
End Sub

End Class

hope this helps..
Imran.

I get 2 errors reading:

vbc : Command line error BC2017 : could not find library
'System.Windows.Forms'

vbc: Fatal error BC2000 : compiler initialization failed unexpectedly: The
system cannot find the file specified.
If this means that I do not have the libraries necessary to run a GUI
application, could someone please give me a link to where I can download
the
SDK. I have already tried one download through MSDN, but it didn't seem to
work. Thanks all.

Nov 21 '05 #5

P: n/a
"Hari" <ha***********@yahoo.com> wrote in message
news:qb********************@adelphia.com...
I tried compiling the following source code:

Imports System
Imports System.Windows.Forms

Public Class Form1

Shared Sub Main
Dim f1 As New Form()
End Sub

End Class
I got the following errors:

error BC30466: Namespace or type 'Forms' for the Imports
'System.Windows.Forms' cannot be found.
Imports System.Windows.Forms
~~~~~~~~~~~~~~~~~~~~


It sounds as though your project is a console application instead of a
Windows Forms application, and the reference to System.Windows.Forms.dll
never got added for you.

Best Regards,

Andy
Nov 21 '05 #6

P: n/a
> Imports System
Imports System.Windows.Forms

Public Class Form1

Shared Sub Main
Dim f1 As New Form()
f1.Width = 300
f1.Height = 300
f1.ShowDialog()
End Sub

End Class


I typed in that exact code, except I called it Form2 and replaced Class
Form1 with Class Form2. Then I typed the following into the command prompt:

vbc /r:System.dll, System.Windows.Forms.dll Form2.vb

and got:

vbc /r:System.dll, System.Windows.Forms.dll Form2.vb
vbc : Command line error BC2001 : file 'System.Windows.Forms.dll' could not
be found

Now what?
Nov 21 '05 #7

P: n/a
> It sounds as though your project is a console >application instead of a
Windows Forms application, and the reference to >System.Windows.Forms.dll

never got added for you.

If so, how do I get the System.Windows.Forms.dll to get added? I tried the
whole referencing thing, but I didn't seem to work. Thanks.
Nov 21 '05 #8

P: n/a
Hari,

That sounds kinda strange.
do you have that dll - System.Windows.Forms.dll - on your machine?
it should be under %Root%\WINNT\Microsoft.NET\Framework\v1.x.xxxx\ for
windows 2000
or under %Root%\Windows\Microsoft.NET\Framework\v1.x.xxxx\ for windows XP.
Infact, that is where vbc.exe is also located - for the default installation
atleast.

let me know..
Imran.

"Hari" <ha***********@yahoo.com> wrote in message
news:47********************@adelphia.com...
Imports System
Imports System.Windows.Forms

Public Class Form1

Shared Sub Main
Dim f1 As New Form()
f1.Width = 300
f1.Height = 300
f1.ShowDialog()
End Sub

End Class

I typed in that exact code, except I called it Form2 and replaced Class
Form1 with Class Form2. Then I typed the following into the command

prompt:
vbc /r:System.dll, System.Windows.Forms.dll Form2.vb

and got:

vbc /r:System.dll, System.Windows.Forms.dll Form2.vb
vbc : Command line error BC2001 : file 'System.Windows.Forms.dll' could not be found

Now what?

Nov 21 '05 #9

P: n/a
THANKS SO MUCH everyone!

I finally got the whole thing to work. First I took Imran's advice and went
looked for the vbc.exe. I found it in
C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322. Also in this directory I found
System.Windows.Forms.dll. I wondered why the whole thing wasn't working and
I typed in:

vbc /r:System.dll, System.Windows.Forms.dll Form2.vb

and got some errors. Then, I removed the space between the comma and
System.Windows..... so I got

vbc /r:System.dll,System.Windows.Forms.dll Form2.vb

AND IT WORKED. Thanks so much everyone, I really owe it all to you guys.
Once again thank you.
Nov 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.