私は、テキストボックスに第一の要素を表示する必要がある文字列配列文字列配列要素を文字列に変換するには?
public: array<String ^>^sss;
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
array<String ^>^sss = gcnew array<String ^>(3);
sss[0]="asdasd";
sss[1]="s115ss";
sss[2]="s115ss";
}
を持っています。
私は、VC++はSystem.NullReferenceException
を与えた
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
textBox2->Text = sss[0];
}
を使用。どうして?それを修正する方法は?
エラー:あなたもsss
と呼ばれるフィールドを持っていない限り
An unhandled exception of type 'System.NullReferenceException' occurred in test000.exe Additional information: Object reference not set to an instance of an object.
完全なスタックトレースを追加してください。あなたが提供した情報に基づいて、私はNullReferenceがオブジェクト 'textbox'ではない' s' –
ではないと賭けています。次のコードは私のプログラムで動作します。textBox2-> Text = "11111"; – user765168