Solved

alphabetize flexgrid contents

Posted on 2014-11-27
10
80 Views
Last Modified: 2014-11-28
I need a way to alphabetize the contents of my MSFlexgrid in the attached project.  I am pulling the websites from a text file to a flexgrid, but using this style of grid, how could I organize the sites alphabeticallly from a text file?
CB--2-.zip
0
Comment
Question by:al4629740
  • 7
  • 3
10 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40469591
OK, I'm working on it.
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40469751
OK I hope this isn't a turkey:)

This version includes
Changes to handle a sorted grid
When the Add Record button is clicked you no longer have to double-click the cell
When the user clicks the "X" to end the application and there have been changes made, the application will give him a chance to save them
Since this application is more complex then it was before I added annotations at the places where I made the current changes. I also added a changelog module to document those changes. See this article of mine if you want to be able to easily do that in this or future applications.
Q-28570862.zip
0
 

Author Comment

by:al4629740
ID: 40469774
Martin, I just opened it and tested it.  It keeps getting better.  Much appreciated.

I like the annotations suggestion.  When the code starts mounting, its easy to forget what was done.

Thank you very much and enjoy your evening!
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 40469859
Once again you're welcome.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40469870
You might want to make a small change. If you add a website which alphabetically is "off the screen" (like if you added "aaaaa.com") you won't see it using the current code unless you scroll to it. If you change this
Private Sub SortGrid()
'******* Q_28570862a Start *******
Dim intEntry As Integer
Dim intRow As Integer

' Sort the grid and add the GridRow vales to arrAlloed
MSFlexGrid1.Sort = flexSortGenericAscending
For intRow = 0 To MSFlexGrid1.Rows - 1
    For intEntry = 0 To UBound(arrAllowed)
        If MSFlexGrid1.TextMatrix(intRow, 0) = arrAllowed(intEntry).MatchValue Then
            arrAllowed(intEntry).GridRow = intRow
            Exit For
        End If
    Next
Next
'******* Q_28570862a End *********
End Sub

Open in new window

to this you will.
Private Sub SortGrid()
'******* Q_28570862a Start *******
Dim intEntry As Integer
Dim intRow As Integer

' Sort the grid and add the GridRow vales to arrAlloed
MSFlexGrid1.Sort = flexSortGenericAscending
For intRow = 0 To MSFlexGrid1.Rows - 1
    For intEntry = 0 To UBound(arrAllowed)
        If MSFlexGrid1.TextMatrix(intRow, 0) = arrAllowed(intEntry).MatchValue Then
            arrAllowed(intEntry).GridRow = intRow
            Exit For
        End If
    Next
Next
MSFlexGrid1.Row = arrAllowed(UBound(arrAllowed)).GridRow
MSFlexGrid1.TopRow = arrAllowed(UBound(arrAllowed)).GridRow
'******* Q_28570862a End *********
End Sub

Open in new window

0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40469909
Currently if you add "aaa.com"  the output file will look like this:
allowed.hsd1.il.comcast.net
^(.*\.)?hsd1.il.comcast.net$
;
ALLOW_DROPBOX_r05-02-2013
^db\.tt$
^(.*\.)?dropboxusercontent\.com$
;
;ALLOW_FACEBOOK_r02-31-2013
^fb\.me$
^(.*\.)?facebook\.com$
^(.*\.)?fbcdn\.com$
^(.*\.)?fbcdn\.net$
;
;ALLOW_TWITTER_r02-28-2013
^t\.co$
^(.*\.)?twimg\.com$
^(.*\.)?twitter\.com$
;
;ALLOW_YOUTUBE_r11-05-2012
^(.*\.)?youtube\.com$
^(.*\.)?youtube-nocookie\.com$
^(.*\.)?abc\.com$
^(.*\.)?googlevideo\.com$
;ALLOW_YOUTUBE_OPTIONAL
^(.*\.)?just1tube\.com$
^(.*\.)?wix\.com$
^(.*\.)?infusionsoft\.com$
^(.*\.)?msexchange\.org$
^(.*\.)?google\.com$
^(.*\.)?googleusercontent\.com$
^(.*\.)?craigslist\.org$
^(.*\.)?microsoftonline\.com$
^(.*\.)?weebly\.com$
^(.*\.)?yahoo\.com$
^(.*\.)?aaa\.xxx$

Would you like it to be

allowed.hsd1.il.comcast.net
^(.*\.)?hsd1.il.comcast.net$
;
ALLOW_DROPBOX_r05-02-2013
^db\.tt$
^(.*\.)?dropboxusercontent\.com$
;
;ALLOW_FACEBOOK_r02-31-2013
^fb\.me$
^(.*\.)?facebook\.com$
^(.*\.)?fbcdn\.com$
^(.*\.)?fbcdn\.net$
;
;ALLOW_TWITTER_r02-28-2013
^t\.co$
^(.*\.)?twimg\.com$
^(.*\.)?twitter\.com$
;
;ALLOW_YOUTUBE_r11-05-2012
^(.*\.)?youtube\.com$
^(.*\.)?youtube-nocookie\.com$
^(.*\.)?abc\.com$
^(.*\.)?googlevideo\.com$
;ALLOW_YOUTUBE_OPTIONAL
^(.*\.)?just1tube\.com$
^(.*\.)?wix\.com$
^(.*\.)?infusionsoft\.com$
^(.*\.)?msexchange\.org$
^(.*\.)?google\.com$
^(.*\.)?googleusercontent\.com$
^(.*\.)?craigslist\.org$
^(.*\.)?microsoftonline\.com$
^(.*\.)?weebly\.com$
^(.*\.)?yahoo\.com$
;ALLOW_MISCELLANEOUS_r11-27-2014
^(.*\.)?aaa\.xxx$
0
 

Author Comment

by:al4629740
ID: 40470021
That would be great if it was that way.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40470406
New question or here?

I also found a bug that I'll fix in either case.
0
 

Author Comment

by:al4629740
ID: 40470516
New question
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40470523
OK thanks. I've actually found a few bugs that I'm fixing now.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question