CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006
    Location
    Mnila, Philippines
    Posts
    171

    Error in sorting datagridview's columns

    I have a datagridview and all its columns are set to Double Datatype. The problem is when I changed the value of cell and try to sort the column, it shows me an error "Object must be of type Double." I check each cell but all its values are number and I can sort all the columns before I edit one cell. But when I tried to change the value of only one cell and sort the columns, the errors will show. Its weird because I only removed 1 digit of the cell value and I cant sort at all.

    Code:
    Dim col As New DataGridViewTextBoxColumn
    col.ValueType = GetType(Double)

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Error in sorting datagridview's columns

    Look up DirectCast()
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured