| 
 | 
								
									
										|  |  
										|  |  
										| |  Click here to copy the following block |  | Option Explicit 
 
 
 
 
 
 
 
 
 
 
 Private Sub Form_Load()
 Dim Str As String
 Dim i As Integer
 Dim j As Integer
 
 i = 0: j = 0
 MSFlexGrid1.Rows = 1
 Randomize
 For i = 1 To Int(Rnd() * 10) + 1
 Str = ""
 For j = 1 To 10
 Str = Str & Chr(65 + Int(Rnd() * 26))
 Next
 MSFlexGrid1.AddItem Int(Rnd() * 100) & vbTab & Str
 Next
 End Sub
 
 Private Sub MSFlexGrid1_Click()
 Call FlexSort("A")
 End Sub
 
 Private Sub MSFlexGrid1_DblClick()
 Call FlexSort("D")
 End Sub
 
 Sub FlexSort(Mode As String)
 If MSFlexGrid1.Row = 1 Then
 If MSFlexGrid1.MouseCol = 0 Then
 MSFlexGrid1.Col = 0
 If Mode = "A" Then
 MSFlexGrid1.Sort = flexSortNumericAscending
 Else
 MSFlexGrid1.Sort = flexSortNumericDescending
 End If
 ElseIf MSFlexGrid1.MouseCol = 1 Then
 MSFlexGrid1.Col = 1
 If Mode = "A" Then
 MSFlexGrid1.Sort = flexSortStringAscending
 Else
 MSFlexGrid1.Sort = flexSortStringDescending
 End If
 End If
 End If
 End Sub
 | 
 |  
										|  |  
										|  |  
 
	
		| Submitted By :
					Nayan Patel 
					 (Member Since : 5/26/2004 12:23:06 PM) |  
		|  |  
		| 
				 | Job Description :   
			He is the moderator of this site and  currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |  
		| View all (893) submissions by this author 
			(Birth Date : 7/14/1981 ) |  |  |