MSHFlexGrid vb6.0

280 pts.
Tags:
MSHFlexGrid
VB
VB 6.0
Visual Basic Sorting
how i control the sorting by asc / dsc while i show the date on the from (MSHFlexGrid) by the sql command. i use DataEnvironment for all purpose, from to report

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you want to sort the data in the FlexGrid, then you should use the <i>col</i>, <i>colsel</i> and <i>sort</i> properties of the control. If you want to get the data sorted from the data source (DataEnvironment), then I think you would need to modify the command text property of the command object.

Assuming that you want to sort the data in the control, this is the way to do it.

The keys used for sorting are determined by the Col and ColSel properties, for example, if you want to sort the data according to the contents of columns 1 and 2, you should set those properties this way:

<pre>MSHFlexGrid1.Col = 1
MSHFlexGrid1.ColSel = 2</pre>

Then you have to set the <i>sort</i> property according to the following possible values:

<pre>Constant Value Description
flexSortNone 0 None. No sorting is performed.
flexSortGenericAscending 1 Generic Ascending. An ascending sort, which estimates whether text is string or number, is performed.
flexSortGenericDescending 2 Generic Descending. A descending sort, which estimates whether text is string or number, is performed.
flexSortNumericAscending 3 Numeric Ascending. An ascending sort, which converts strings to numbers, is performed.
flexSortNumericDescending 4 Numeric Descending. A descending sort, which converts strings to numbers, is performed.
flexSortStringNoCaseAsending 5 String Ascending. An ascending sort using case-insensitive string comparison is performed.
flexSortNoCaseDescending 6 String Descending. A descending sort using case-insensitive string comparison is performed.
flexSortStringAscending 7 String Ascending. An ascending sort using case-sensitive string comparison is performed.
flexSortStringDescending 8 String Descending. A descending sort using case-sensitive string comparison is performed.
flexSortCustom 9 Custom. This uses the Compare event to compare rows.
</pre>

For example:

<pre>MSHFlexGrid1.Sort = 1</pre>

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • John14
    hello i need a little help on how to sort the data in flexgrid 1-50. i can't sort the numbers i am trying to save 1 - 9 it's ok but when i save 10 to 19 it's look like this: 1 10 11 2 3 4 5 6 7 8 9 how will i solve this problem for it to become like this 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 and so on thanks for the help in advance
    10 pointsBadges:
    report
  • 30111966
    how to enter data in  MSHFlexGrid control for eg. billing  data
    particular, qty, rate , amount , calculation : qty * rate

    how to use isNull value function in data entry program
    pl send code on my email - ch_sagar_30jan@yahoo.com

    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following