User (Legacy) Posted April 23, 2004 Report Share Posted April 23, 2004 Hi, could someone shed some light on why i am getting a TargetInvocationException (full error text below) from my winform app? All it does is draw a simple chart and add two lines to it as annotations, i provide the full code below. That much works fine. HOWEVER, if i hit the Go button to run the chart again it throws the error. I tried clearing the chart using "AllData", it didn't help. Something is not being re-set properly, but what!!?? thx j. ============================================================================ ======== ERROR An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in system.windows.forms.dll Additional information: Exception has been thrown by the target of an invocation ============================================================================ ======== CODE Imports System.Math 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 Button1 As System.Windows.Forms.Button Friend WithEvents Chart1 As SoftwareFX.ChartFX.Chart <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button Me.Chart1 = New SoftwareFX.ChartFX.Chart Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(56, 16) Me.Button1.Name = "Button1" Me.Button1.TabIndex = 0 Me.Button1.Text = "Go" ' 'Chart1 ' Me.Chart1.AxisX.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.None Me.Chart1.AxisX.MinorTickMark = SoftwareFX.ChartFX.TickMark.Inside Me.Chart1.AxisX.TickMark = SoftwareFX.ChartFX.TickMark.Outside Me.Chart1.AxisY.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.None Me.Chart1.AxisY.LogBase = 10 Me.Chart1.AxisY.MinorTickMark = SoftwareFX.ChartFX.TickMark.Inside Me.Chart1.AxisY.TickMark = SoftwareFX.ChartFX.TickMark.Outside Me.Chart1.AxisY2.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.None Me.Chart1.AxisY2.MinorTickMark = SoftwareFX.ChartFX.TickMark.Inside Me.Chart1.AxisY2.TickMark = SoftwareFX.ChartFX.TickMark.Outside Me.Chart1.DataEditorObj.Alignment = SoftwareFX.ChartFX.ToolAlignment.Spread Me.Chart1.DataEditorObj.Docked = SoftwareFX.ChartFX.Docked.Bottom Me.Chart1.DataEditorObj.Interlaced = SoftwareFX.ChartFX.Interlaced.None Me.Chart1.DataEditorObj.ToolBorder = SoftwareFX.ChartFX.ToolBorder.None Me.Chart1.DesignTimeData = "D:\Program Files\ChartFX.Netv6.2\Wizard\LogScale.txt" Me.Chart1.Gallery = SoftwareFX.ChartFX.Gallery.Curve Me.Chart1.GalleryObj.Native = True Me.Chart1.LegendBoxObj.Alignment = SoftwareFX.ChartFX.ToolAlignment.Center Me.Chart1.LegendBoxObj.Docked = SoftwareFX.ChartFX.Docked.Right Me.Chart1.LegendBoxObj.Flags = SoftwareFX.ChartFX.LegendBoxFlag.Default Me.Chart1.LegendBoxObj.ToolBorder = SoftwareFX.ChartFX.ToolBorder.None Me.Chart1.LineWidth = 4 Me.Chart1.Location = New System.Drawing.Point(40, 72) Me.Chart1.MarkerShape = SoftwareFX.ChartFX.MarkerShape.None Me.Chart1.Name = "Chart1" Me.Chart1.NValues = 15 Me.Chart1.SerLegBoxObj.Alignment = SoftwareFX.ChartFX.ToolAlignment.Center Me.Chart1.SerLegBoxObj.Docked = SoftwareFX.ChartFX.Docked.Right Me.Chart1.SerLegBoxObj.Flags = SoftwareFX.ChartFX.LegendBoxFlag.Default Me.Chart1.SerLegBoxObj.ToolBorder = SoftwareFX.ChartFX.ToolBorder.None Me.Chart1.Size = New System.Drawing.Size(512, 392) Me.Chart1.TabIndex = 1 Me.Chart1.UserLegendBoxObj.Alignment = SoftwareFX.ChartFX.ToolAlignment.Center Me.Chart1.UserLegendBoxObj.Docked = SoftwareFX.ChartFX.Docked.Right Me.Chart1.UserLegendBoxObj.Flags = SoftwareFX.ChartFX.LegendBoxFlag.Default Me.Chart1.UserLegendBoxObj.ToolBorder = SoftwareFX.ChartFX.ToolBorder.None ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(608, 524) Me.Controls.Add(Me.Chart1) Me.Controls.Add(Me.Button1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) End Sub #End Region Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click buildchart() End Sub ''========================================================================== ============== Sub buildchart() Dim ChannelPts(3, 25) As Double Dim NumChannelPts, StartingPt, NumBasePoints As Integer '' NumBasePoints = 20 Dim intJ As Integer Chart1.ClearData(SoftwareFX.ChartFX.ClearDataFlag.AllData) Chart1.Gallery = SoftwareFX.ChartFX.Gallery.Lines Chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 1, NumBasePoints) For intJ = 0 To NumBasePoints - 1 Chart1.Value(0, intJ) = intJ * intJ Next Chart1.CloseData(SoftwareFX.ChartFX.COD.Values) Chart1.AxisY.AutoScale = True Chart1.Titles(0).Text = "Quadratic?" '' '' now add the trend/support/resistance lines '' Dim annot As SoftwareFX.ChartFX.Annotation.AnnotationX annot = New SoftwareFX.ChartFX.Annotation.AnnotationX '' AddLine(annot, 1, 3, 3, 5, 1) AddLine(annot, 1, 3, 16, 25, 1) Chart1.Extensions.Add(annot) End Sub ''========================================================================== ============== Sub AddLine(ByRef annot As SoftwareFX.ChartFX.Annotation.AnnotationX, _ ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, _ ByVal ColorIdx As Integer) '' Dim arrow As SoftwareFX.ChartFX.Annotation.AnnotationArrow arrow = New SoftwareFX.ChartFX.Annotation.AnnotationArrow arrow.Attach(x1, y1, x2, y2) arrow.Color = System.Drawing.Color.SaddleBrown arrow.Border.Color = System.Drawing.Color.SaddleBrown '' this doesn't seem to do anything... arrow.Width = 3 '' '' watch the end caps, they turn off the arrow but can turn off the whole line! '' if you are displaying vertical & horizontal lines If x1 = x2 Then 'arrow.EndCap.Width = 0 arrow.EndCap.Height = 0 Else If Abs((y1 - y2) / y2) < 0.01 Then arrow.EndCap.Width = 0 'arrow.EndCap.Height = 0 Else arrow.EndCap.Width = 0 arrow.EndCap.Height = 0 End If End If '' annot.List.Add(arrow) End Sub End Class Link to comment Share on other sites More sharing options...
Software FX Posted April 26, 2004 Report Share Posted April 26, 2004 Using the latest Chart FX 6.2 SP I do not get any errors when I run this application.I can press the Go button and no errors either, I get the attached chart. -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted April 27, 2004 Author Report Share Posted April 27, 2004 But, did you press the "Go" button a 2nd time, right after the first. That is when it dies.... I upgraded my version to v6.2 SP that is on the web site, so that ChartFX.dll is file last modified 3/19/04 assembly version 6.2.1342.0 file version 6.2.1539.21391 Same problem still exists.....on the 2nd click it dies every time with An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in system.windows.forms.dll Additional information: Exception has been thrown by the target of an invocation. Link to comment Share on other sites More sharing options...
Software FX Posted April 27, 2004 Report Share Posted April 27, 2004 Ah ! ok. Now I get the crash. It wasn't clear to me in the first posting that I had to press the GO button twice. There is a bug in ClearData. We will fix this problem in the next SP. Workaround, avoid calling ClearData with AllData. Instead, include the flags that you need only but DO NOT include Extensions. For example: Data Chart1.Extensions.Clear() Chart1.ClearData(SoftwareFX.ChartFX.ClearDataFlag.Data) -- FP Software FX Link to comment Share on other sites More sharing options...
prayaggandhi Posted September 9, 2009 Report Share Posted September 9, 2009 We have downloaded the latest Service Pack for Chart FX 6.2 and we have the exact same problem occurring in Vista. I thought SP suppose to fix this problem. Any thoughts? Link to comment Share on other sites More sharing options...
makeshse Posted April 25, 2013 Report Share Posted April 25, 2013 Hello ChartFx Support We are getting the same error that is indicated in this thread with Windows 2008 terminal server. The workaround suggested doesn't seem to work. Do we have a different workaround or a patch that does fix this issue? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.