error C2440: '=' : cannot convert from 'System::Drawing::Point' to 'cli::array<Type> ^

Hello i get a error C2440: '=' : cannot convert from 'System::Drawing::Point' to 'cli::array<Type> ^' at line# 85
Can some one help?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

#pragma once

namespace Triangle {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->SuspendLayout();
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->BackColor = System::Drawing::Color::LightGray;
			this->ClientSize = System::Drawing::Size(284, 262);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::Form1_Paint);
			this->ResumeLayout(false);

		}
#pragma endregion

				 static int Ax = 20;
				 static int Ay = 20;
				 static int Bx = 50;
				 static int By = 150;
				 static int Cx = 250;
				 static int Cy = 250;
				 
				 static Graphics^ myg;

				 static array<Point>^ ABC;

	private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
				 myg=CreateGraphics();
			 }
	private: System::Void Form1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {

				 ABC = Point(Ax,Ay),Point(Bx,By),Point(Cx, Cy);}



			 }

			};	
			 }
index your array line 85

 
ABC[0]
If i do this program crash and i get error:

An unhandled exception of type 'System.NullReferenceException' occurred in MyProgram.exe

Additional information: Object reference not set to an instance of an object.
You need to construct the managed array.
http://msdn.microsoft.com/en-us/library/ts4c4dw6(VS.80).aspx
Thank you naraku9333.
Topic archived. No new replies allowed.