System.StackOverflowException when a I use a custom class

Posted on 2011-05-05
Last Modified: 2012-05-11
Im doing a system that draw customized diagrams

Im trying to implement this code
Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Drawing
Imports Nevron.Diagram
Imports Nevron.GraphicsCore
Imports Nevron.Dom
<Serializable()> _
Public Class tanques
    Inherits NRectangleShape
#Region " properties ..."
    Private e_conectado As String
    Public Property conectado() As String
            Return e_conectado
        End Get
        Set(ByVal value As String)
            e_conectado = value
        End Set
    End Property
#End Region

    Public Sub New(ByVal a As Single, ByVal b As Single, ByVal c As Single, ByVal d As Single)
        MyBase.New(a, b, c, d)
    End Sub
End Class

Open in new window

to use a customized shape when I add a new node

After I add the new node to the workspace everything looks fine but when I try to move the node with the mouse visual basic show the following error: "exception System.StackOverflowException on mscorlib.dll

I would like to know what is happend???

My custom form is ok???

Do I need to add another thing???

Question by:altariamx2003
    LVL 74

    Accepted Solution

    Can you provide the definition of the NRectangleShape class?
    LVL 85

    Assisted Solution

    by:Mike Tomlinson
    ...and if not handled by that class, we need to see the code that handles the moving of a node with the mouse.

    Author Comment

    I dont have the code, this is what i got using .net reflector

    <Serializable> _
    Public Class NRectangleShape
        Inherits NPathShape
        ' Methods
        <EditorBrowsable(EditorBrowsableState.Never)> _
        Public Sub New()
        Public Sub New(ByVal primitive As NRectanglePath)
        Public Sub New(ByVal rect As NRectangleF)
        Public Sub New(ByVal corners As NPointF())
        Public Sub New(ByVal leftTop As NPointF, ByVal rightBottom As NPointF)
        Public Sub New(ByVal location As NPointF, ByVal size As NSizeF)
        Public Sub New(ByVal corner1 As NPointF, ByVal corner2 As NPointF, ByVal corner3 As NPointF, ByVal corner4 As NPointF)
        Public Sub New(ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single)
        Protected Overrides Sub CreateDefaultLabels()
    End Class
    <Serializable, XmlInclude(GetType(NPolyPathShape)), XmlInclude(GetType(NArrowShape)), XmlInclude(GetType(NLineShape)), XmlInclude(GetType(NRectangleShape)), XmlInclude(GetType(NEllipseShape)), XmlInclude(GetType(NEllipticalArcShape)), XmlInclude(GetType(NCircularArcShape)), XmlInclude(GetType(NBezierCurveShape)), XmlInclude(GetType(NStepConnector))> _
    Public MustInherit Class NPathShape
        Inherits NPrimitiveShape
        Implements INPoints, INDiagramElement, INElement, INNode, INIdentifiable, INUniquelyIdentifiable, INAttributeContainer, INAttributeObserver, ICloneable
        ' Methods
        Public Sub New(ByVal primitive As NPathPrimitive)
        Protected Overrides Function GetDefaultShapeElements() As ShapeElementsMask
        Public Overridable Function GetPointAt(ByVal index As Integer) As NPointF
        Public Overridable Function GetPointInfo(ByVal index As Integer) As NPointInfo
        Public Overridable Sub SetPointAt(ByVal index As Integer, ByVal point As NPointF)
        ' Properties
        <Category("Scene"), Description("Gets/sets the shape points"), XmlIgnore> _
        Public Overridable Property Points As NPointF()
        <Browsable(False)> _
        Public Overridable ReadOnly Property PointsCount As Integer
    End Class

    Open in new window

    LVL 85

    Assisted Solution

    by:Mike Tomlinson
    Where did you get the control from?

    Without access to the code there are only a few options:
    (1) The control is buggy.  Without source code you can't fix it.  Get rid of it...
    (2) You are setting up the control wrong.  Without documentation we can't help you.
    (3) You are doing something at run-time with the controls that it doesn't like.  Show us code or see #2.

    Author Comment

    I know that there is a big problem, nrectangleshape is provided by the libraries of nevron

    I know that you need the souce code, but right know its impossible to me

    thx anyway for your time


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now