ComponentOne Input for WinForms
In This Topic
    Updating /Refreshing Data from the Database
    In This Topic

    This topic demonstrates how you can use the Update/Refresh button to send changes and re-fetch data from the database. Complete the following steps:

    1. Add a C1DbNavigator control to your form and select the control to view its Properties window.
    2. Expand the VisibleButtons property node and set Update and Refresh to True. Set the default navigation buttons (Next, Previous, First, Last) to False.
    3. Set the PositionVisible property to False. As an option, you can set its ColorButtons property to True for the buttons to have color bitmaps:
    4. To make the Update and Refresh buttons functional, add a Click event handler to the C1DbNavigator component. Enter the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Private Sub c1DbNavigator1_UpdateData(sender As Object, e As System.EventArgs)
       c1ExpressConnection1.Update()
    End Sub
     
    Private Sub c1DbNavigator1_RefreshData(sender As Object, e As System.EventArgs)
       c1ExpressConnection1.Fill()
    End Sub
    

    To write code in C#

    C#
    Copy Code
    private void c1DbNavigator1_UpdateData(object sender, System.EventArgs e)
    {
        c1ExpressConnection1.Update();
    }
     
    private void c1DbNavigator1_RefreshData(object sender, System.EventArgs e)
    {
        c1ExpressConnection1.Fill();
    }