'Object Variable or with block variable not set and FocusRowChanged gridview does not display images accordingly in vb.net
Please solve the problem "Object variable or With block variable not set" whether this is because there is an empty database column or something else. FocusRowChanged gridview does not display images accordingly. You can see the screenshot below showing an image that doesn't match the blue circle when I move to another row. For the record I used a visual studio 2010.
thanks jack
Private Sub GridView1_FocusedRowChanged(ByVal sender As System.Object, ByVal e As FocusedRowChangedEventArgs) Handles GridView1.FocusedRowChanged
Dim view As GridView = TryCast(sender, GridView)
If e.FocusedRowHandle <> GridControl.InvalidRowHandle Then
Dim SUBFOLDERP As String = view.GetFocusedRow("SUBFOLDERP").ToString
If SUBFOLDERP IsNot Nothing Then
Dim Filename1 As String = view.GetFocusedRow("FILENAME1").ToString
Dim Filename2 As String = view.GetFocusedRow("FILENAME2").ToString
Dim Filename3 As String = view.GetFocusedRow("FILENAME3").ToString
Dim Code As String = view.GetFocusedRow("CODE").ToString
Dim filePath1 As String = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & "\" & SUBFOLDERP & "\", Filename1, False)
Dim filePath2 As String = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & "\" & SUBFOLDERP & "\", Filename2, False)
Dim filePath3 As String = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & "\" & SUBFOLDERP & "\", Filename3, False)
If Not String.IsNullOrWhiteSpace(filePath1) Then
PictureEdit1.Image = Image.FromStream(New MemoryStream(File.ReadAllBytes(filePath1)), True, False)
If Not String.IsNullOrWhiteSpace(filePath2) Then
PictureEdit2.Image = Image.FromStream(New MemoryStream(File.ReadAllBytes(filePath2)), True, False)
If Not String.IsNullOrWhiteSpace(filePath3) Then
PictureEdit3.Image = Image.FromStream(New MemoryStream(File.ReadAllBytes(filePath3)), True, False)
End If
End If
End If
End If
End If
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|



