griview data event, change sort order

Post

Posted
Rating:
#1 (In Topic #713)
Regular
bill-lancaster is in the usergroup ‘Regular’
I've been using the data event in gridview, the data source is a mysql database.
It all works fine.
When changing the sort order of a column in the database result, how is the Data event triggered?

Code

Public Sub Button1_Click()
  hResultMaster = hConn.Find("master", "ORDER BY Narrative")
  FMain.Activate
End

The gridview display is empty after this action.

In other words, if the order of records in hResultMaster is changed, how to invoke the Data event to reflect this change?
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
bill-lancaster is in the usergroup ‘Regular’
This seems to do the trick.

Code

Public Sub gdvMaster_Sort()
Dim sOrder As String
  If gdvMaster.Columns.Ascending Then
    sOrder = gdvMaster.Columns[gdvMaster.Columns.Sort].Text
  Else
    sOrder = gdvMaster.Columns[gdvMaster.Columns.Sort].Text & " DESC"
  Endif
  hResultMaster = hConn.Find("master", "ORDER BY " & sOrder)
  gdvMaster.Clear
Online now: No Back to the top
1 guest and 0 members have just viewed this.