Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Help! I am not having any luck compiling a simple VB.NET hello world program from the command line.

 

I'm following the directions at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaconvbcompileroptions.asp

 

So here is what I type:

vbc /reference:Microsoft.VisualBasic.dll form1.vb

 

Using visual studio.net (2002) all I did was create a new windows application, add a button, with a msgbox routine when clicked. (all this

code was automatically created by the IDE)

 

Public Class Form1
   Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

   Public Sub New()
       MyBase.New()

       'This call is required by the Windows Form Designer.
       InitializeComponent()

       'Add any initialization after the InitializeComponent() call

   End Sub

   'Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.  
   'Do not modify it using the code editor.
 Friend WithEvents Button1 As System.Windows.Forms.Button
 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
   Me.Button1 = New System.Windows.Forms.Button()
   Me.SuspendLayout()
   '
   'Button1
   '
   Me.Button1.Location = New System.Drawing.Point(120, 96)
   Me.Button1.Name = "Button1"
   Me.Button1.TabIndex = 0
   Me.Button1.Text = "Button1"
   '
   'Form1
   '
   Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
   Me.ClientSize = New System.Drawing.Size(292, 273)
   Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
   Me.Name = "Form1"
   Me.Text = "Form1"
   Me.ResumeLayout(False)

 End Sub

#End Region

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
   MsgBox("hello there world...")
 End Sub
End Class

 

I get errors like the following:

vbc : error BC30420: 'Sub Main' was not found in 'Form1'.
C:\temp\Form1.vb(15) : error BC30002: Type 'System.Windows.Forms.Form' is not defined.

   Inherits System.Windows.Forms.Form
            ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\temp\Form1.vb(30) : error BC30284: sub 'Dispose' cannot be declared 'Overrides' because it does not override a sub in a base class.

   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

 

Anybody have any ideas what I'm doing wrong???? Thanks in advance...

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...