in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

DBNULL EXCEPTION ERROR

Last post 11/17/2008 10:57 AM by John Haldi. 1 replies.
Page 1 of 1 (2 items)
Sort Posts:
Previous Next
  • 11/14/2008 9:11 PM

    DBNULL EXCEPTION ERROR

     I have a gridview that that show a web address text, i'm catching the value of the focus row-cell to navigate to those website, I get in error  when  the cell is null

    How can I add an (if is null  into this code) so I dont get an exception dbnull error....Conversion from type 'DBNull' to type 'String' is not valid.

    Private

    Sub GridView1_FocusedRowChanged(ByVal sender As System.Object, ByVal e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridView1.FocusedRowChanged

     

    Dim CellValue As

    String

    CellValue = GridView1.GetFocusedRowCellValue(

    "HotelWebSite")

    WebBrowser1.Navigate(CellValue)

     

    End

    Sub

    Filed under:
  • 11/17/2008 10:57 AM In reply to

    Re: DBNULL EXCEPTION ERROR

    Have you tried this?:

    If gridview1.GetFocusedRowCellValue("HotelWebSite") IsNot DBNull.Value then

         Dim CellValue as string = gridview1.GetFocusedRowCellValue("HotelWebSite")

         WebBrowser1.Navigate(CellValue)

    End If

Page 1 of 1 (2 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED