Esempio n. 1
0
 /// <summary>
 /// Shows error messages.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (GridView.SelectedRows.Count > 0)
     {
         DataGridViewRow drSelected = GridView.SelectedRows[0];
         string          sError     = drSelected.GetErrorText(drSelected.Index);
         if (sError != "")
         {
             MessageBox.Show(sError, "Live Feed", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Esempio n. 2
0
        public void DataGridViewRowErrorTextNeededEventArgs_ErrorText_Set_GetReturnsExpected(string value)
        {
            var dataGridView = new DataGridView
            {
                ColumnCount = 1,
                VirtualMode = true
            };
            DataGridViewRow row = dataGridView.Rows[0];

            int callCount = 0;
            DataGridViewRowErrorTextNeededEventHandler handler = (sender, e) =>
            {
                callCount++;
                e.ErrorText = value;
                Assert.Equal(value, e.ErrorText);
            };

            dataGridView.RowErrorTextNeeded += handler;

            Assert.Same(value, row.GetErrorText(0));
            Assert.Equal(1, callCount);
        }