datagridview combobox cell value is not valid C# || Solved 100 %

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 42

  • @miltoneduardoespinoza4320
    @miltoneduardoespinoza4320 4 ปีที่แล้ว

    Great, i spend lot of time looking for the answer, Thanks so much

  • @23BrotherWolf
    @23BrotherWolf 16 วันที่ผ่านมา

    Great!!!! Work for me!

  • @emqudrummer
    @emqudrummer 7 ปีที่แล้ว +2

    Dude, you safe ma life ^_^. I've been looking for this solution but got no idea

    • @abbasthegreat5
      @abbasthegreat5  7 ปีที่แล้ว

      you are welcome.
      Regards:
      E-Learning Portal

  • @yairkatz9443
    @yairkatz9443 3 ปีที่แล้ว

    Thank you! been working on this problem for hours

  • @gustaneviomangue
    @gustaneviomangue 6 ปีที่แล้ว +2

    Sir, u saved my life, thanks

  • @medmeskine2762
    @medmeskine2762 3 ปีที่แล้ว

    thank u so much for solving us this problem

  • @zyad_mz9238
    @zyad_mz9238 2 ปีที่แล้ว +1

    Thank you for that 😊☺️

  • @tmhchacham
    @tmhchacham 3 ปีที่แล้ว

    Checking the error text is not a great idea, as it might change. Instead, use the Context property of the DataGridViewDataErrorEventArgs parameter to check for the appropriate DataGridViewDataErrorContexts. For example, in VB:
    AddHandler [DataGridView].DataError, Sub(Sender As Object, Arguments As DataGridViewDataErrorEventArgs) If Arguments.Context = DataGridViewDataErrorContexts.Formatting + DataGridViewDataErrorContexts.PreferredSize Then .Cancel = True

  • @jimrobertson6959
    @jimrobertson6959 5 ปีที่แล้ว

    Thank-you. This helped me greatly!

  • @sanjivchauhan2773
    @sanjivchauhan2773 5 ปีที่แล้ว +1

    Thanks a lot. It worked for me. Thanks again

  • @nabeelbin-hamdain5396
    @nabeelbin-hamdain5396 5 ปีที่แล้ว +3

    problem can be solve easily by making sure the data you trying to fill in are exactly match the data in COMBOBOX in length and data (Space is consider )

    • @dickwoodman7814
      @dickwoodman7814 5 ปีที่แล้ว

      Explain more, you idiot.

    • @attininolmodammir1512
      @attininolmodammir1512 4 ปีที่แล้ว

      @@dickwoodman7814 LMAO u calling him an idiot when is sefinetly right , he gave a simple explanation , the value inside the combobox needs to match a value of its items u dumb fucktard

  • @spisebanan
    @spisebanan 4 ปีที่แล้ว

    Thanks! This was very helpfull.

  • @diegospinedi8417
    @diegospinedi8417 3 ปีที่แล้ว

    Great! is too much!!! i solved my problem!!!

  • @TimmyThings
    @TimmyThings 5 ปีที่แล้ว

    the values are not showing in combobox ! :|

  • @gamingkidunia6002
    @gamingkidunia6002 4 ปีที่แล้ว

    if (e.Exception.Message == "DataGridViewComboBoxCell value is not valid.")
    {
    object value = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
    if (!((DataGridViewComboBoxColumn)dataGridView1.Columns[e.ColumnIndex]).Items.Contains(value))
    {
    ((DataGridViewComboBoxColumn)dataGridView1.Columns[e.ColumnIndex]).Items.Add(value);
    e.ThrowException = false;
    }
    }

  • @sharehackfree
    @sharehackfree 3 ปีที่แล้ว

    Good video

  • @matheusperrotperrot4002
    @matheusperrotperrot4002 6 ปีที่แล้ว +1

    Hi were is the data in the comments?

    • @abbasthegreat5
      @abbasthegreat5  6 ปีที่แล้ว

      There is no need to enter any data.
      Just generate the Data Error event of DataGridView.

  • @احمدبلو-ه3ت
    @احمدبلو-ه3ت 2 ปีที่แล้ว

    great.. where is the code in the comments plz

  • @ahmedal-tayeb6793
    @ahmedal-tayeb6793 4 ปีที่แล้ว

    good job

  • @vuminkosivincentmatibe3216
    @vuminkosivincentmatibe3216 6 ปีที่แล้ว +1

    thank you sir

  • @mickantonio245
    @mickantonio245 3 ปีที่แล้ว

    Thanks

  • @jetrogadiane3713
    @jetrogadiane3713 6 ปีที่แล้ว

    Where can i find the dataerror in vb.net

  • @aparnaappu5195
    @aparnaappu5195 4 ปีที่แล้ว

    thanks you

  • @appiah212
    @appiah212 4 ปีที่แล้ว

    Please kindly help with VB.net version

  • @augustinmca1620
    @augustinmca1620 6 ปีที่แล้ว

    didnt found ur coding under the comments

    • @abbasthegreat5
      @abbasthegreat5  6 ปีที่แล้ว

      Augustin MCA Good point. But Actually there is no need to paste any code there.
      Just create the event i mentioned in the video and your issue will be resolved simply.
      Regards:
      E-Learning Portal

    • @augustinmca1620
      @augustinmca1620 6 ปีที่แล้ว +1

      Issue is cleared. Its Worthy

    • @peterashraf2266
      @peterashraf2266 6 ปีที่แล้ว

      I think the code will be like this :
      Using vb.net Language :
      If (TypeOf (e.Exception) Is ConstraintException) Then
      Dim view As DataGridView = CType(sender, DataGridView)
      view.Rows(e.RowIndex).ErrorText = "an error"
      view.Rows(e.RowIndex).Cells(e.ColumnIndex) _
      .ErrorText = "an error"
      e.ThrowException = False
      End If
      Using c# Language:
      if ((anError.Exception) is ConstraintException)
      {
      DataGridView view = (DataGridView)sender;
      view.Rows[anError.RowIndex].ErrorText = "an error";
      view.Rows[anError.RowIndex].Cells[anError.ColumnIndex].ErrorText = "an error";
      anError.ThrowException = false;
      }

    • @augustinmca1620
      @augustinmca1620 6 ปีที่แล้ว

      for c#
      private void dgwcarpentry_DataError(object sender, DataGridViewDataErrorEventArgs e)
      {
      if (e.Exception.Message != "")
      {
      object value = dgwcarpentry.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
      if (!((DataGridViewComboBoxColumn)dgwcarpentry.Columns[e.ColumnIndex]).Items.Contains(value))
      {
      ((DataGridViewComboBoxColumn)dgwcarpentry.Columns[e.ColumnIndex]).Items.Add(value);
      e.ThrowException = false;
      }
      }
      }
      //dgwcarpentry(dataGridView1)

    • @PenTol2Kub
      @PenTol2Kub 6 ปีที่แล้ว

      Than you.
      I'm Test with vb.net Language.
      It work.

  • @abbasthegreat5
    @abbasthegreat5  7 ปีที่แล้ว

    //This event is used to avoid the error of DataGridviewCombobox Cell
    if (e.Exception.Message == "DataGridViewComboBoxCell value is not valid.")
    {
    object value = grdPurchaseQMaster.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
    if (!((DataGridViewComboBoxColumn)grdPurchaseQMaster.Columns[e.ColumnIndex]).Items.Contains(value))
    {
    ((DataGridViewComboBoxColumn)grdPurchaseQMaster.Columns[e.ColumnIndex]).Items.Add(value);
    e.ThrowException = false;
    }
    }

    • @harryhasson5388
      @harryhasson5388 7 ปีที่แล้ว

      Hithe line ((DataGridViewComboBoxColumn)dataGridView.Columns[e.ColumnIndex]).Items.Add(value);fails. because ausing error: items cannot be modified when dataSource is set

    • @abbasthegreat5
      @abbasthegreat5  7 ปีที่แล้ว

      yes, You cannot modify the value of any DatagridviewColumn or Cell if you have assigned a datatable to your DataGridView.
      So, Do one thing. email your project on my email:
      abbas.thegreat5@gmail.com
      I will resend it you after correcting the error.
      But if you are not able to send me. Then do this:
      Populate your DataGridView by assigning values to each row by using k loop(for or foreach)
      for(int i=0; i

  • @saeedizadi4369
    @saeedizadi4369 4 ปีที่แล้ว

    ای خدا پدرتو بیامرزه دهنم صاف شده بود با این ارور