How to force FetchRowStyle event to activate

Posted by: Victor.m.charles.civ on 4 December 2019, 9:19 am EST

    • Post Options:
    • Link

    Posted 4 December 2019, 9:19 am EST

    Hi,

    When first load Form2 FetchRowstyle executes but when I press the back button to back to Form1 and return to Form2 FetchRowStyle does not execute. How do I force it to activate everytime I return to Form2?

    Thanks,

    Victor

  • Posted 5 December 2019, 5:24 am EST

    Hello,

    We can replicate the same scenario at our end and this happen as there is no change in the view of Form that contains TrueDBGrid so to explicitly raise the FetchRowstyle event, you need to call the Refresh method of TrueDBGrid in the Form2’s Activated event as given in code snippet below :

    private void Form2_Activated(object sender, EventArgs e)
    {
      c1TrueDBGrid1.Refresh();
    }
    

    Please find the attached sample demonstrating the same.

    Regards,

    Prabhat Sharma.

    TDBFormSwitch.zip

  • Posted 6 December 2019, 1:21 pm EST

    Hi,

    It seems like the application freezes because of the code in the Selchange event. When first executed all goes well, but return to Form1 to view the data again in Form2, that part of the code seems to be stuck in a look because the Msgbox AA,BA,CC keeps repeating. How do I prevent this issue?

    Private Sub C1AOP5_SelChange(sender As Object, e As CancelEventArgs) Handles C1AOP5.SelChange

        s.Clear()
        s1.Clear()
    
        For Each row In Me.C1AOP5.SelectedRows
            s.Add(C1AOP5.Columns("NSN").CellText(row))
        Next
        MsgBox("AA")
    
        '  C1AOP40T.Refresh()
    
        For i As Integer = 0 To C1AOP40T.Splits(0).Rows.Count - 1
            If s1.Contains(C1AOP40T.Columns("NSN").CellText(i)) Then
                C1AOP40T.SelectedRows.Add(i)
            End If
            If s1.Count = 0 Then
                C1AOP40T.SelectedRows.Clear()
            End If
        Next
        MsgBox("BB")
    
        C1AOP40T.Refresh()
        C1AOP5.Refresh()
        e.Cancel = True
        MsgBox("CC")
    

    End Sub

  • Posted 9 December 2019, 5:05 am EST

    Hello,

    Sorry but we could not replicate the issue at our end and the application do not freeze also.

    I have created a sample using your given code snippet, kindly modify it or provide your own stripped down sample replicating the issue so that we can provide you a helpful solution.

    Regards,

    Prabhat Sharma.

    TDBFetchRowStyleDemo.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels