Need some quick help!

I need help making this into an array. It doesn't work with windowns form application?
 
float f_tempTopPlate[1];
closed account (30X1hbRD)
You probably know this, but an array has to start with 0, not 1. I dunno if that's the problem, but that usually fixes some of my array problems
I tried that and that doesn't fix my problem. I get 2 errors:
1
2
3
 error C2440: '=' : cannot convert from 'int' to 'float []'
1>        There are no conversions to array types, although there are conversions to references or pointers to arrays
error C4368: cannot define 'f_tempTopPlate' as a member of managed 'Telemetry1::Form1': mixed types are not supported
closed account (30X1hbRD)
can you post the whole code?
It's very long, but here is the part I am having trouble with.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public ref class Form1 : public System::Windows::Forms::Form
 {
 
 float f_tempTopPlate;
}
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
int PlotData1;
int i;

f_tempTopPlate = 2;

for(i = 0; i < 16; i++)
{
   PlotData1 = f_tempTopPlate = 7*i - 20;
}
chart6->Series->Add("Series1");
chart6->Series["Series1"]->Color = Color::Green;
chart6->Series["Series1"]->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Line;
chart6->Series["Series1"]->Points->AddXY(0,PlotData1);


I want to make it into an array of 16.
You're going to want to call AddXY from within your loop.
1
2
3
4
5
6
7
8
9
chart6->Series->Add("Series1");
chart6->Series["Series1"]->Color = Color::Green;
chart6->Series["Series1"]->ChartType = 
     System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Line;
for(i = 0; i < 16; i++)
{
   PlotData1 = f_tempTopPlate = 7*i - 20;
   chart6->Series["Series1"]->Points->AddXY(0,PlotData1);
}


BTW, AddXY takes two doubles. PlotData1 is an int.

What's the point of setting f_tempTopPlate at line 10 when you overwrite it at line 14?
Okay, I got it to work! Thanks for your help!
Topic archived. No new replies allowed.