|
-
Jul 3rd, 2004, 11:55 PM
#1
Thread Starter
New Member
Form1
Hi all,
I'm very new to this Visual Basic thing. In class we were shown how to choose properties of a form that we have renamed to frmHomework or something similar.
For some reason I do not have a drop down selection from tools to do the same at home. I'm sure it's a version difference but...how can I change the name of the current form to something other then Form1 without getting compile errors.
(name) is Form1 but when changed I get this error.
There were build errors.
'Sub Main' was not found in example1.Form1'.
To me it's simply is saying hey it's not the same thing so make sure you rename it in the right places. but the trouble i'm having is i'm having trouble finding all the right places.
Not sure if this will help or not but here's the code.
Public Class frm3_3_1
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 lblFirst As System.Windows.Forms.Label
Friend WithEvents lblSecond As System.Windows.Forms.Label
Friend WithEvents txtFirst As System.Windows.Forms.TextBox
Friend WithEvents txtSecond As System.Windows.Forms.TextBox
Friend WithEvents btnCompute As System.Windows.Forms.Button
Friend WithEvents txtSum As System.Windows.Forms.TextBox
Friend WithEvents lblSum As System.Windows.Forms.Label
Friend WithEvents btnClose As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.lblFirst = New System.Windows.Forms.Label()
Me.lblSecond = New System.Windows.Forms.Label()
Me.txtFirst = New System.Windows.Forms.TextBox()
Me.txtSecond = New System.Windows.Forms.TextBox()
Me.btnCompute = New System.Windows.Forms.Button()
Me.txtSum = New System.Windows.Forms.TextBox()
Me.lblSum = New System.Windows.Forms.Label()
Me.btnClose = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'lblFirst
'
Me.lblFirst.Location = New System.Drawing.Point(48, 48)
Me.lblFirst.Name = "lblFirst"
Me.lblFirst.Size = New System.Drawing.Size(56, 24)
Me.lblFirst.TabIndex = 0
Me.lblFirst.Text = "First Number"
'
'lblSecond
'
Me.lblSecond.Location = New System.Drawing.Point(48, 88)
Me.lblSecond.Name = "lblSecond"
Me.lblSecond.Size = New System.Drawing.Size(72, 24)
Me.lblSecond.TabIndex = 1
Me.lblSecond.Text = "Second Number"
'
'txtFirst
'
Me.txtFirst.Location = New System.Drawing.Point(112, 56)
Me.txtFirst.Name = "txtFirst"
Me.txtFirst.TabIndex = 2
Me.txtFirst.Text = ""
'
'txtSecond
'
Me.txtSecond.Location = New System.Drawing.Point(112, 88)
Me.txtSecond.Name = "txtSecond"
Me.txtSecond.TabIndex = 3
Me.txtSecond.Text = ""
'
'btnCompute
'
Me.btnCompute.Location = New System.Drawing.Point(48, 168)
Me.btnCompute.Name = "btnCompute"
Me.btnCompute.Size = New System.Drawing.Size(168, 48)
Me.btnCompute.TabIndex = 4
Me.btnCompute.Text = "Compute &Sum"
'
'txtSum
'
Me.txtSum.Location = New System.Drawing.Point(112, 128)
Me.txtSum.Name = "txtSum"
Me.txtSum.ReadOnly = True
Me.txtSum.TabIndex = 5
Me.txtSum.Text = ""
'
'lblSum
'
Me.lblSum.Location = New System.Drawing.Point(48, 128)
Me.lblSum.Name = "lblSum"
Me.lblSum.Size = New System.Drawing.Size(56, 23)
Me.lblSum.TabIndex = 6
Me.lblSum.Text = "Sum"
'
'btnClose
'
Me.btnClose.Location = New System.Drawing.Point(48, 232)
Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(168, 48)
Me.btnClose.TabIndex = 7
Me.btnClose.Text = "Close"
'
'frm3_3_1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(248, 302)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnClose, Me.lblSum, Me.txtSum, Me.btnCompute, Me.txtSecond, Me.txtFirst, Me.lblSecond, Me.lblFirst})
Me.Name = "frm3_3_1"
Me.Text = "Example 3.3.1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
'Clicking the button will add the sum of the numbers in txtFirst & txtSecond
Dim sum As Double
sum = CDbl(txtFirst.Text) + CDbl(txtSecond.Text)
txtSum.Text = CStr(sum)
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
'terminates the program
Me.Close()
End Sub
End Class
Help???
-M
Last edited by zendakin; Jul 4th, 2004 at 12:13 AM.
-
Jul 4th, 2004, 05:04 AM
#2
When I get that message (through absent mindedness mainly in my case) there is usually a small dialog box that pops up with a list of candidates for objects that have the sub main().
I usually double click the new form name from the list. Is this the list that you are referring to?
What version of VB are you using? I'm on Standard 2003 at the moment (FW1.1)
I don't live here any more.
-
Jul 4th, 2004, 05:07 AM
#3
Try this:
Project...Properties...Common Properties...General...Startup Object
Set it to the form name.
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|