Jump to content
Software FX Community

NullReferenceException in chart.set_ValueEx


User (Legacy)

Recommended Posts

Using ChartFX client server + financial extention:

I put the following lines of code ( VB.net) in a button click to drow my

data on a chart:

//////////////////start of code////////////////////////////

chart.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES, 5, ds.Tables(0).Rows.Count -

1)

chart.OpenDataEx(ChartfxLib.CfxCod.COD_XVALUES, 1, ds.Tables(0).Rows.Count -

1)

For count = 0 To ds.Tables(0).Rows.Count - 1

chart.set_ValueEx(0, count, ds.Tables(0).Rows(count)("Low"))

chart.set_ValueEx(1, count, ds.Tables(0).Rows(count)("open"))

'<--- the red line

chart.set_ValueEx(2, count, ds.Tables(0).Rows(count)("close"))

chart.set_ValueEx(3, count, ds.Tables(0).Rows(count)("high"))

chart.set_ValueEx(4, count, ds.Tables(0).Rows(count)("vol"))

chart.set_XValueEx(0, count,

ds.Tables(0).Rows(count)("ts_date").Date.ToOADate())

Next count

chart.CloseData(ChartfxLib.CfxCod.COD_VALUES)

chart.CloseData(ChartfxLib.CfxCod.COD_XVALUES)

//////////////////end of code////////////////////////////

this code works well when I click on the button for the first time BUT for

the second time

the red line throws a nullreference exception

Why this happens? and how can I overcome this?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...