Results 1 to 5 of 5

Thread: [RESOLVED] DBNull to type String is not valid. From a datagrid

Hybrid View

  1. #1
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    Re: DBNull to type String is not valid. From a datagrid

    Before assigning it to the textbox you can check whether it is null or not by using this

    vb Code:
    1. If TypeOf datagrid.Item(0, eRow).Value Is DBNull Then

  2. #2
    Junior Member
    Join Date
    Jul 2010
    Posts
    28

    Re: DBNull to type String is not valid. From a datagrid

    Hi.

    The other way you could do it, is to use the .ToString method.

    Code:
    txtSelecteditem.Text = datagrid.Item(0, eRow).Value.ToString
    That way, any value that is DBNull (blank) will be filled as it is on the textbox.

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