Witam,
mam troche trywialny problem z dodaniem tekstu z elementu textBox do komorki dataGridView :) Mianowicie - tworze okno dialogowe:
private: System::Void toolStripButton1_Click(System::Object^ sender, System::EventArgs^ e) {
Form^ oknoGrupa = gcnew Form;
// Parametry tworzonego okna;
oknoGrupa->Text="Dodaj grupę kalkulacyjną";
oknoGrupa->Width = 300;
oknoGrupa->Height = 150;
// label 1
Label^ label1 = gcnew Label;
label1->Text = "Grupa kalkulacyjna";
label1->Location=Point(6,20);
// label 2
Label^ label2 = gcnew Label;
label2->Text = "Suma 1";
label2->Location=Point(6,44);
// pole tekstowe 1
TextBox^ grupaKalk = gcnew TextBox;
grupaKalk->Width=100;
grupaKalk->Location=Point(124,17);
//grupaKalk->Text = "grupa pierwsza";
// pole tekstowe 2
TextBox^ sumaZ = gcnew TextBox;
sumaZ->Width=100;
sumaZ->Location=Point(124,41);
// przycisk DODAJ
Button^ dodaj = gcnew Button;
dodaj->Text = "Dodaj grupę";
dodaj->Location=Point(150,80);
// przycisk CANCEL
Button^ cancel = gcnew Button;
cancel->Text = "Wróć";
cancel->Location=Point(50,80);
// wyswietls kontrolki
oknoGrupa->Controls->Add(grupaKalk);
oknoGrupa->Controls->Add(sumaZ);
oknoGrupa->Controls->Add(label1);
oknoGrupa->Controls->Add(label2);
oknoGrupa->Controls->Add(dodaj);
oknoGrupa->Controls->Add(cancel);
// Obs≥uga zdarzeŮ przyciskůw
dodaj->DialogResult = System::Windows::Forms::DialogResult::OK;
cancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
// Wyswietl okno
oknoGrupa->ShowDialog();
dataGridView1->Rows->Add();
int col = dataGridView1->ColumnCount;
int row = dataGridView1->RowCount;
dataGridView1->Rows[row]->Cells[1]->Value = grupaKalk->Text->ToString();
//dataGridView1->Columns->Insert(liczba - 1, "asd");
}
Tak wiec ten kod nie dziala - dodaje wylacznie wiersz. Probowalem na kilka sposobow i cos nie dziala...