Hi,
I'm trying to convert our application from Vulcan to X#. There are many many compiler errors, some are real errors, the most not, but I can go around them.
But this time I need help.
I get error XS1503 Argument 1: cannot convert from 'int' to 'string' accessing an element of a collection (oChartAreaCollection[0])
Please help me. Thank you.
Thomas
//--------------------------------------------------------------
Method CantCompile() As Void
Local oChart As System.Windows.Forms.DataVisualization.Charting.Chart
Local oChartAreaCollection As System.Windows.Forms.DataVisualization.Charting.ChartAreaCollection
Local oChartArea As System.Windows.Forms.DataVisualization.Charting.ChartArea
oChart := System.Windows.Forms.DataVisualization.Charting.Chart{}
// oChart:ChartAreas[0]:Area3DStyle:Rotation
oChartAreaCollection := oChart:ChartAreas
oChartArea := oChartAreaCollection[0]
Return
Please help compiling
Please help compiling
Hi Thomas,
I cannot understand why the compiler is not able to understand that the Item access of the ChartAreaCollection class accepts both string and numeric indices:
https://docs.microsoft.com/en-us/dotnet ... tem_Int32_
https://docs.microsoft.com/en-us/dotnet ... em_String_
IMHO your code is correct, and I have the same error on my machine.
So you have to wait for the development team.
Wolfgang
I cannot understand why the compiler is not able to understand that the Item access of the ChartAreaCollection class accepts both string and numeric indices:
https://docs.microsoft.com/en-us/dotnet ... tem_Int32_
https://docs.microsoft.com/en-us/dotnet ... em_String_
IMHO your code is correct, and I have the same error on my machine.
So you have to wait for the development team.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Please help compiling
You appear to have commented out the assignment of oChart:ChartAreas[0] to Area3DStyle.Rotation
That line appears to have ":" and not ":=" which I expect would cause the compiler to hiccup.
Just a guess
Terry
That line appears to have ":" and not ":=" which I expect would cause the compiler to hiccup.
Just a guess
Terry
Please help compiling
Guys, yeah this looks like a compiler bug, it's probably confused because there is both an int and a string indexer. For now, the only workaround I can think of, is to use FOREACH for this property and simply get the first item only (for index 0) etc.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Please help compiling
Hi Chris,
yes, I think this too....
And then call with
Wolfgang
yes, I think this too....
Code: Select all
method GetChartArea( oChartAreaCollection as System.Windows.Forms.DataVisualization.Charting.ChartAreaCollection, nIndex as int ) as System.Windows.Forms.DataVisualization.Charting.ChartArea
local oReturn as System.Windows.Forms.DataVisualization.Charting.ChartArea
local nCurrent as int
oReturn := null
nCurrent := 0
foreach oItem as System.Windows.Forms.DataVisualization.Charting.ChartArea in oChartAreaCollection
if nCurrent == nIndex
oReturn := oItem
exit
endif
++nCurrent
next
return oReturn
Code: Select all
oChartArea := self:GetChartArea( oChartAreaCollection, 0 )
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Please help compiling
Thank you for your answers. You confirmed a bug.
And thank you Wolfgang for your code snipped.
regards Thomas
And thank you Wolfgang for your code snipped.
regards Thomas