0

there is a problem if I use FocusedRow changes because the image that appears from the previous row still appears. Below I attach a screenshot. How can I solve the problem?

Thanks

result1 result2

Private Sub GridView1_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridView1.FocusedRowChanged
        Dim view As GridView = TryCast(sender, GridView)

        If view.FocusedRowHandle = GridControl.AutoFilterRowHandle Then
            Return
        End If

        Dim SUBFOLDERP As String = view.GetFocusedRowCellValue("SUBFOLDERP")?.ToString
        Dim Filename1 As String = view.GetFocusedRowCellValue("FILENAME1")?.ToString
        Dim Filename2 As String = view.GetFocusedRowCellValue("FILENAME2")?.ToString
        parentpathimage = Directory.GetCurrentDirectory()
        Dim filePath1 = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & "\" & SUBFOLDERP & "\", Filename1, False)
        Dim filePath2 = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & "\" & SUBFOLDERP & "\", Filename2, 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)
            End If
        End If
    End Sub
roy
  • 693
  • 2
  • 11
  • Have you checked the values in filePath1 and filePath2? Is maybe filePath2 empty? – Marko Juvančič Dec 30 '22 at 10:35
  • @MarkoJuvančič , for "ITM = TEST R 1000" has filepath1 only and "ITM = TEST R 1001" has filepath1 and filepath2. `Is maybe filePath2 empty?` yes you are right ,one of those items has an empty filepath2 how the image in the picture edit appears accordingly – roy Dec 30 '22 at 12:35
  • Then you should handle the empty filePath2 -> clear the second image. It remains set now. – Marko Juvančič Dec 31 '22 at 13:01
  • @MarkoJuvančič , thanks for your reply how can I handle for an empty filepath – roy Jan 01 '23 at 10:17

0 Answers0