when casting from a number, the value must be a number less than infinity.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: when casting from a number, the value must be a number less than infinity.

  1. #1
    Join Date
    Aug 2009
    Posts
    1

    when casting from a number, the value must be a number less than infinity.

    I have a datagrid where I am trying to remove only the first row where the barcode matches.

    I had it working this way however it removed all of the matching barcodes instead of just the first one

    dgItems.DataSource = ((List<Items>)dgItems.DataSource).Where(i => i.BarCode != barcodeProduct).ToList();

    I switched it over to this however i am receiving the error when casting from a number, the value must be a number less than infinity.

    Items foundPiece = ((List<Items>)dgItems.DataSource).First(i => (i.BarCode == barcodeProduct));
    ((List<Items>)dgItems.DataSource).Remove(foundPiece);

    Any ideas?

  2. #2
    Join Date
    Jul 2006
    Posts
    297

    Re: when casting from a number, the value must be a number less than infinity.

    Try running it in the debugger and see what value its complaining about. I assume you have a double value somewhere that is the value of infinity. You need to find out what it doesn't like first, then find out why that value is infinity.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center