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

newB GUI library problems

P: n/a
I am very new to programming GUI VB.NET, and I just tried making a simple
Form popup with a button that says OK and a label that says "Hello world". I
have Visual Studio, but I am not familiar with the making a "Windows
Application". I would like to just program, using code, enough to make what
I mentioned above.

I started with:

Public Class Form1
Inherits System.Windows.Forms.Form

But the compiler said System.Windows.Forms.Form was not defined. How do I
start?

P.S.
I would like to create my first GUI program without the assistance of Visual
Studio's Windows Application maker.
Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
If I get the appropriate library that I have to import, then I am sure that
I can find the syntax to the name the label "Hello World" and the button
"OK". But I need the code the make the frame visible, to put the button on
the frame, and to put the label on the frame. Since I fully know Java, I
should be able to get the conceptual ideas of GUI ok, but I need the actual
syntax.

-Sorry for not including this in the original message.
If you would like to contact me personally (which I discourage), then remove
the x from my e-mail address.
Nov 21 '05 #2

P: n/a
you need to add this to the top of your code before your class form1

Imports System
Imports System.Windows.Forms

"Hari" <ha***********@yahoo.com> wrote in message
news:Bq********************@adelphia.com...
I am very new to programming GUI VB.NET, and I just tried making a simple
Form popup with a button that says OK and a label that says "Hello world".
I
have Visual Studio, but I am not familiar with the making a "Windows
Application". I would like to just program, using code, enough to make
what
I mentioned above.

I started with:

Public Class Form1
Inherits System.Windows.Forms.Form

But the compiler said System.Windows.Forms.Form was not defined. How do I
start?

P.S.
I would like to create my first GUI program without the assistance of
Visual
Studio's Windows Application maker.

Nov 21 '05 #3

P: n/a
When I added

Imports System
Imports System.Windows.Forms

to the my file I got the following errors in Command Prompt:
C:\hari\VB\GUI\Starting>vbc Form1.vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

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

Imports System.Windows.Forms
~~~~~~~~~~~~~~~~~~~~
error BC30002: Type 'System.Windows.Forms.
Form' is not defined.

Inherits System.Windows.Forms.Form
~~~~~~~~~~~~~~~~~~~~~~~~~
error BC30002: Type 'Form' is not defined.
Dim f1 As New Form()
~~~~
Nov 21 '05 #4

P: n/a
* "Hari" <ha***********@yahoo.com> scripsit:
I started with:

Public Class Form1
Inherits System.Windows.Forms.Form

But the compiler said System.Windows.Forms.Form was not defined. How do I
start?


Are you sure a reference to "System.Windows.Forms.dll" is set? If you
are using "vbc.exe" to compile your application, take a look at the '/r'
(or '/reference') option.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #5

P: n/a
> Are you sure a reference to >"System.Windows.Forms.dll" is set? If you
are using "vbc.exe" to compile your application, take a >look at the '/r'
(or '/reference') option.


I'm very new to VB.NET, so I'm not sure what exactly you mean. I typed in
vbc /r, but it told me I needed a file_list. How do I set a reference to
System.Windows.Forms.Form. I've run basic programs through which I print to
the console, which means I must have some libraries. But I'm not sure if I
need to download something from the net. Please help! Thanks.
Nov 21 '05 #6

P: n/a
* "Hari" <ha***********@yahoo.com> scripsit:
Are you sure a reference to >"System.Windows.Forms.dll" is set? If you
are using "vbc.exe" to compile your application, take a >look at the '/r'
(or '/reference') option.


I'm very new to VB.NET, so I'm not sure what exactly you mean. I typed in
vbc /r, but it told me I needed a file_list. How do I set a reference to
System.Windows.Forms.Form. I've run basic programs through which I print to
the console, which means I must have some libraries. But I'm not sure if I
need to download something from the net. Please help! Thanks.


The libraries are installed on your system if the .NET Framework is
installed. I assume that the Framework is installed if "vbc.exe" is
available. To add a reference, add something like
'/r:System.Windows.Forms.dll' to your command line.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #7

P: n/a
I downloaded the SDK for VB.Net (although i think I already had it) and then
typed in

vbc /r:System.Windows.Forms.dll

into the Command Prompt. I got an error reading:

vbc : Command line error BC2008 : no input sources specified.

Then 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 #8

P: n/a
* "Hari" <ha***********@yahoo.com> scripsit:
vbc /r:System.Windows.Forms.dll


You'll have to specify the source files that should be compiled too.
Please post your complete command line to "vbc".

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.