Advertisement
Maksud3

CellValueChanged

Apr 30th, 2020
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. private: System::Void dataGridView1_CellStateChanged(System::Object^ sender, System::Windows::Forms::DataGridViewCellStateChangedEventArgs^ e) {
  2.  
  3.     if (!isRefreshed)
  4.     {
  5.         for (int i = 0; i < dataGridView1->Rows->Count - 1; i++)
  6.         {
  7.             if (dataGridView1->Rows[i]->Cells["amount"]->Value != nullptr &&
  8.                 Int32::Parse(dataGridView1->Rows[i]->Cells["amount"]->Value->ToString()) < 0)
  9.             {
  10.                 dataGridView1->Rows[i]->Cells["amount"]->Value = "0";
  11.                 dataGridView1->Rows[i]->Cells["availability"]->Value = false;
  12.             }
  13.             else if (dataGridView1->Rows[i]->Cells["amount"]->Value != nullptr &&
  14.                 Int32::Parse(dataGridView1->Rows[i]->Cells["amount"]->Value->ToString()) == 0)
  15.             {
  16.                 dataGridView1->Rows[i]->Cells["availability"]->Value = false;
  17.             }
  18.             else if (dataGridView1->Rows[i]->Cells["amount"]->Value != nullptr &&
  19.                 Int32::Parse(dataGridView1->Rows[i]->Cells["amount"]->Value->ToString()) > 0)
  20.             {
  21.                 dataGridView1->Rows[i]->Cells["availability"]->Value = true;
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement