none
DataGridView Default Error Dialog - handle the DataError event - Wie und wo? RRS feed

  • Frage

  • http://www1.minpic.de/bild_anzeigen.php?id=139915&key=63724247

    Hallo,

    ich bekomme teils die Meldung. Nicht immer!!! Meist klappt es.

    Was kann ich dagegen tun? Wir von einem anderen Thread aufgerufen. Evtl. ist das das Problem?!?

    Grüße Andreas

     

    ---------------------------
    DataGridView Default Error Dialog
    ---------------------------
    The following exception occurred in the DataGridView:System.InvalidOperationException: BindingSource cannot be its own data source. Do not set

    the DataSource and DataMember properties to values that refer back to BindingSource.   at System.Windows.Forms.BindingSource.get_Count()   at

    System.Windows.Forms.CurrencyManager.get_Item(Int32 index)   at System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetError(Int32

    rowIndex)To replace this default dialog please handle the DataError event.
    ---------------------------
    OK  
    ---------------------------

     drv.BeginEdit();
          drv["Quantity"] = newCount;
          drv.EndEdit();
    
          if (newCount <= 0)
          {
            drv.Delete();
            // ** Zeile selektieren
            BS.Position = dGVMaterial.Rows.Count;
            if (dGVMaterial.Rows.Count > 1)
              dGVMaterial.Rows[dGVMaterial.Rows.Count - 2].Selected = true;
          }
          for (int i = 0; i < dGVMaterial.Rows.Count; i++)
          {
            if (i == 0)
              dGVMaterial.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
            else if (i != BS.Position)
              dGVMaterial.Rows[i].DefaultCellStyle.BackColor = Color.White;
          }
          DataRowView row = (DataRowView)BS.Current;
    
          Int32 counterActual = GetSumPanels();
    

     

     

    Freitag, 4. März 2011 15:09

Antworten

Alle Antworten