System.ArithmeticException in VStudio 2003

G

Guest

Hi,

I'm using Windows XP SP1 with Visual Studio 2003. I add a
blank form to a project, then I add a default control of
any type (label, button, etc) to that form. When I build
and run the project, it gets
a 'System.ArithmeticException' error at the point where
it's adding the control to the 'Controls' collection of
the form. Again, both the form and control that I add
have default properties. I don't even change the name.

Here's some sample code with an asterisk where it gets an
error:

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 Label1 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private
Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(0,
0)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 0
Me.Label1.Text = "Label1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
Me.ClientSize = New System.Drawing.Size(292, 266)
* Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

End Class


I would appreciate any help. I'm kind of dead in the
water until this gets fixed.
 
H

Herfried K. Wagner [MVP]

* said:
I'm using Windows XP SP1 with Visual Studio 2003. I add a
blank form to a project, then I add a default control of
any type (label, button, etc) to that form. When I build
and run the project, it gets
a 'System.ArithmeticException' error at the point where
it's adding the control to the 'Controls' collection of
the form. Again, both the form and control that I add
have default properties. I don't even change the name.

Change the form's font and try again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top