Solved

alphabetize flexgrid contents

Posted on 2014-11-27
10
81 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

790 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