Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi,

I am trying to learn vb.net.

I have just started my second program, however it complains that "\MainForm.vb(27) : error BC30002: Type 'Size' is not defined."

"Me.AutoScaleBaseSize = new Size(5, 13)"

If I try to compile it via command line (I had to add a path to vbc.exe in my environment variables) it throws up multiple errors

 

\Desktop\vb code>vbc /t:exe /debug+ /optionstrict

+ /out:.\HelloVB.exe Hello.vb

Microsoft ® Visual Basic .NET Compiler version 7.10.3052.4

for Microsoft ® .NET Framework version 1.1.4322.573

Copyright © Microsoft Corporation 1987-2002. All rights reserved.

 

\Desktop\vb code\hello.vb(3) : error BC30466: Name

space or type 'Forms' for the Imports 'System.Windows.Forms' cannot be found.

 

Imports System.Windows.Forms

~~~~~~~~~~~~~~~~~~~~

\Desktop\vb code\hello.vb(4) : error BC30466: Name

space or type 'Drawing' for the Imports 'System.Drawing' cannot be found.

 

Imports System.Drawing

~~~~~~~~~~~~~~

\Desktop\vb code\hello.vb(5) : error BC30466: Name

space or type 'ComponentModel' for the Imports 'System.ComponentModel' cannot be

found.

 

Imports System.ComponentModel

~~~~~~~~~~~~~~~~~~~~~

\Desktop\vb code\hello.vb(12) : error BC30456: 'Sh

owDialog' is not a member of 'Main.MainForm'.

 

 

' project created on 02/09/2003 at 15:05
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel


Module Main

Sub Main
	Dim fMainForm As New MainForm
	fMainForm.ShowDialog()

	MessageBox.Show("Hello World!")
End Sub

Public Class MainForm
	Inherits System.Windows.Forms.Form
	Private components As Container
  		Private WithEvents button1 As Button
   	Private textBox1 As New TextBox


  		Public Sub New
     		MyBase.New()
		Me.Text = "Hello World"
		Me.AutoScaleBaseSize = new Size(5, 13)
	     	'Me.ClientSize = new Size(392, 117)

   	    'Me.MinimumSize = new Size(392, (117 + SystemInformation.CaptionHeight))

 	    	button1 = new Button()
   	    'button1.Location = new Point(56, 64)
       	'button1.Size = new Size(90, 40)
       	button1.TabIndex = 2
       	button1.Text = "Click Me!"

       	textBox1.Text = "Hello Windows Forms World"
       	textBox1.TabIndex = 1
       	'textBox1.Size = new Size(360, 20)
       	'textBox1.Location = new Point(16, 24)

       	Me.AcceptButton=button1

       	Me.Controls.Add(button1)
       	Me.Controls.Add(textBox1)
	End Sub
	
End Class


End Module

 

I am using SharpDevelop. Could someone give me a hand please?

Thanks.

Edited by Pedant
Posted

Does anyone use command line then? I think my .NET sdk may nto be properly installed or something as I would have assumed that environment variables would have been set up if it were?

Thanks.

  • *Experts*
Posted
You need to use the /reference:System.Windows.Forms.dll,otherfiles.dll commandline when compiling, if you're not already. Make sure you reference the proper DLLs.
Posted
You need to use the /reference:System.Windows.Forms.dll,otherfiles.dll commandline when compiling, if you're not already. Make sure you reference the proper DLLs.

 

Well, this showed an improvement :) "\Desktop\vb code>vbc /reference:System.Windows.For

ms.dll /t:exe /debug+ /optionstrict+ /out:.\HelloVB.exe show.vb"

 

has different errors now.

 

"\Desktop\vb code\show.vb(12) : error BC30456: 'Sho

wDialog' is not a member of 'Main.MainForm'.

 

fMainForm.ShowDialog()

~~~~~~~~~~~~~~~~~~~~

\Desktop\vb code\show.vb(18) : error BC30007: Refe

rence required to assembly 'System' containing the base class 'System.ComponentM

odel.Component'. Add one to your project.

 

Inherits System.Windows.Forms.Form

~~~~~~~~~~~~~~~~~~~~~~~~~"

etc. I looked and ShowDialog "Overloads Public Function ShowDialog() As DialogResult" and DialogResult is "(in System.Windows.Forms.dll)" which I include so I could do with some more help please.

Thanks

Posted

Almost perfect :) a good thing since I am about to hit my bed. However, I am not up to the stage where I was in SharpDevelop

// Scratch that.

 

Perfect, included System.Drawing.Dll and it compiles happily now. Bedtime methinks. Is there an easier way of finding dependencies other than the .Net Framework SDK?

Thanks a lot, Hopefully I will get somewhere tomorrow.

  • *Experts*
Posted
Im not sure if thats what you mean but you can check in what assembly anything is by looking at the description of each class in the documentation. On the bottom they have a line thats says: "Assembly: name of the dll".
Posted
Im not sure if thats what you mean but you can check in what assembly anything is by looking at the description of each class in the documentation. On the bottom they have a line thats says: "Assembly: name of the dll".

 

That is what I was looking at, I was wondering if there was maybe a -simple- diagram somewhere which showed dependencies.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...