Results 1 to 12 of 12

Thread: [RESOLVED] Win32Exception out of nowhere.

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Resolved [RESOLVED] Win32Exception out of nowhere.

    I have been using this control for over a year now and suddenly it randomly causes exceptions. And by random, I mean I can rebuild the solution and the form with load correctly. Sometimes I have to rebuild two or three times, but eventually it will work properly. The stack trace is vague at best. This might be easier if the exception was consistent.

    Here is the entire code of the control:
    VB.NET Code:
    1. Imports System.ComponentModel
    2. Imports System.Drawing
    3.  
    4. Public Class EditorForm
    5.  
    6.     Private _color As Color = Color.FromArgb(32, 40, 56)
    7.     Private _font As Font = New Font("segoe ui", 8.5)
    8.     Private _formBorderStyle As Windows.Forms.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    9.     Private _foreColor As Color = Color.FromArgb(128, 144, 160)
    10.  
    11.  
    12.     <Browsable(True), DefaultValue(GetType(Color), "32, 40, 56"), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
    13.     Overrides Property BackColor As Color
    14.         Get
    15.             Return _color
    16.         End Get
    17.         Set(value As Color)
    18.             MyBase.BackColor = value
    19.         End Set
    20.     End Property
    21.  
    22.     <Browsable(True), DefaultValue(GetType(Color), "128, 144, 160"), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
    23.     Overrides Property ForeColor As Color
    24.         Get
    25.             Return MyBase.ForeColor
    26.         End Get
    27.         Set(value As Color)
    28.             If Not MyBase.ForeColor = value Then
    29.                 MyBase.ForeColor = value
    30.                 Invalidate()
    31.             End If
    32.         End Set
    33.     End Property
    34.  
    35.     Sub New()
    36.  
    37.         ' This call is required by the designer.
    38.         InitializeComponent()
    39.  
    40.         ' Add any initialization after the InitializeComponent() call.
    41.         SetStyle(Windows.Forms.ControlStyles.OptimizedDoubleBuffer Or Windows.Forms.ControlStyles.SupportsTransparentBackColor Or Windows.Forms.ControlStyles.UserPaint, True)
    42.         DoubleBuffered = True
    43.  
    44.         BackColor = _color
    45.         ForeColor = _foreColor
    46.  
    47.         Font = _font
    48.         FormBorderStyle = _formBorderStyle
    49.     End Sub
    50.  
    51. End Class

    VB.NET Code:
    1. <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    2. Partial Class EditorForm
    3.     Inherits System.Windows.Forms.Form
    4.  
    5.     'UserControl overrides dispose to clean up the component list.
    6.     <System.Diagnostics.DebuggerNonUserCode()> _
    7.     Protected Overrides Sub Dispose(ByVal disposing As Boolean)
    8.         Try
    9.             If disposing AndAlso components IsNot Nothing Then
    10.                 components.Dispose()
    11.             End If
    12.         Finally
    13.             MyBase.Dispose(disposing)
    14.         End Try
    15.     End Sub
    16.  
    17.     'Required by the Windows Form Designer
    18.     Private components As System.ComponentModel.IContainer
    19.  
    20.     'NOTE: The following procedure is required by the Windows Form Designer
    21.     'It can be modified using the Windows Form Designer.  
    22.     'Do not modify it using the code editor.
    23.     <System.Diagnostics.DebuggerStepThrough()> _
    24.     Private Sub InitializeComponent()
    25.         Me.SuspendLayout()
    26.         '
    27.         'EditorForm
    28.         '
    29.         Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(32, Byte), Integer), CType(CType(40, Byte), Integer), CType(CType(56, Byte), Integer))
    30.         Me.ClientSize = New System.Drawing.Size(737, 590)
    31.         Me.DoubleBuffered = True
    32.         Me.Font = New System.Drawing.Font("Segoe UI", 8.5!)
    33.         Me.ForeColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(144, Byte), Integer), CType(CType(160, Byte), Integer))
    34.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
    35.         Me.Name = "EditorForm"
    36.         Me.ResumeLayout(False)
    37.  
    38.     End Sub
    39.  
    40. End Class

    Attached is a screencap I grabbed of the error.
    Attached Images Attached Images  
    Prefix has no suffix, but suffix has a prefix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width