system Arithmetic Exception Error.

G

Guest

Hi, I have a pc with windows XP SP1, net Framworks 1.1 and visual studio net 2003

When I first installed Visual Studio 2003, I noticed I was getting th
follow error when showing a form

A first chance exception of type 'System.ArithmeticException' occurred i
system.drawing.dl
Additional information: Overflow or underflow in the arithmetic operatio

It is being thrown on the line that attempts to add the controls to th
form's controls collection (in the windows forms designer generated cod
region)

email (e-mail address removed)
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?bWZjMjAwNA==?= said:
Hi, I have a pc with windows XP SP1, net Framworks 1.1 and visual studio net 2003.


When I first installed Visual Studio 2003, I noticed I was getting the
follow error when showing a form:

A first chance exception of type 'System.ArithmeticException' occurred in
system.drawing.dll
Additional information: Overflow or underflow in the arithmetic operation

It is being thrown on the line that attempts to add the controls to the
form's controls collection (in the windows forms designer generated code
region).

Can you post the form's complete code?
 
G

Guest

Hi

I've been getting the very same error on the very same operating system configuration, so here's my code. This was generated by adding a windows form with all default properties (including the name even) and then adding a label control with all default properties. If I run the form WITHOUT a control, it works. But as soon as I add ANY control, it gets a System.ArithmeticException error in System.Drawing. I've marked the line of code where it errors out with an asterisk

Public Class Form
Inherits System.Windows.Forms.For

#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() cal

End Su

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

'Required by the Windows Form Designe
Private components As System.ComponentModel.IContaine

'NOTE: The following procedure is required by the Windows Form Designe
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor
Friend WithEvents Label1 As System.Windows.Forms.Labe
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent(
Me.Label1 = New System.Windows.Forms.Labe
Me.SuspendLayout(

'Label

Me.Label1.Location = New System.Drawing.Point(0, 0
Me.Label1.Name = "Label1
Me.Label1.TabIndex =
Me.Label1.Text = "Label1

'Form

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 Su

#End Regio

End Clas
 

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