Hi Guys,
When my application begins, it will run the SQL Fill command, which loads the data Order by Urgent. In context, rows that are considered "Urgent" will be on Top.
Here is the SQL statement in Fill methodCode:Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.ProjectsTableAdapter.Fill(Me.EVC_ProjectsDataSet.Projects) End Sub
Code:SELECT ID, PO, Site, Client, Description, Lead_Time, Job_Status, Production_Status, Last_Updated, Remark, Date_Of_Entry, Urgent FROM Projects ORDER BY Urgent
Now sometimes, the user might click on a column in the GridView, causing it to sort by some other fields.
Hence, I created a Refresh button, which will revert the GridView state to the initial where it should Order by Urgent again.
By my understanding, the Refresh Button will call the Fill method, which should execute the initial SQL and Order by Urgent again. But upon testing, it does not work. The GridView is still sorted according to what the column was last click.Code:Private Sub refresh_btn_Click(sender As Object, e As EventArgs) Handles refresh_btn.Click EVC_ProjectsDataSet.Clear() Me.ProjectsTableAdapter.Fill(Me.EVC_ProjectsDataSet.Projects) End Sub
In Summary, when the Refresh Button is clicked, the GridView should revert to Sort by Urgent Column.
How do I do that?




Reply With Quote
