Solved

FlexGrid not sorting/exporting during entering values

Posted on 2014-11-28
57
97 Views
Last Modified: 2014-12-10
I have the attached project.  When I enter a new website name it prompts me to enter into the grid in blue.  After entering the value, it only works if I click on another row.  However, when I push the enter key to accept the value, it does not work.  i would like to also push the enter key and allow the same execution as when I click on another row.
CB.zip
0
Comment
Question by:al4629740
  • 29
  • 28
57 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40471030
This should allow you to use Enter. In addition to that you should use Notepad to remove all ^(.*\.)?\.$ entries from the file.
Q-28571318.zip
0
 

Author Closing Comment

by:al4629740
ID: 40471076
Thank you!
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471144
I'm glad I've been able to help you. If you come across any bugs, post them here rather than a new question and I'll be happy to do what I can.
0
 

Author Comment

by:al4629740
ID: 40471179
Martin,

I have to make sure that blanks fill ins do not happen on the flexgrid.  For example, if I click Add New and then "decide" not to enter any website, I have a dilemma.  Then I have to push Esc and then find a blank line.  

As a result I get   ^(.*\.)?\.$  

This produces a blank and no blanks should ever exist in the file.

Should I open a new request to fix this?
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471181
No, I'll take care of it.
0
 

Author Comment

by:al4629740
ID: 40471188
Thank you
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471218
I'm also going to add more validation for the website name, because now for example you can enter "aa   aa.com" and get away with it. No new question needed.
0
 

Author Comment

by:al4629740
ID: 40471221
Perfect!!

Yes the format only needs to be website.com
Not www.website.com
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471223
Please see this short article. I'd like to validate the length of the website name and I assume you want it to be 63 characters or less, but apparently it can be longer. Please let me know what length I should use.

BTW I thought that the "domain" was the part following the last dot, like ".com", but apparently not. Can you tell me what that part of the name is called?
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471226
I also found this quote, so I'm happy to add full validation, but I need your guidance as to what I should validate.
Each label may contain up to 63 characters. The full domain name may not exceed the length of 253 characters in its textual representation
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471233
BTW I thought that the "domain" was the part following the last dot, like ".com", but apparently not. Can you tell me what that part of the name is called?
I answered my own question here, it's the "top-level domain".
0
 

Author Comment

by:al4629740
ID: 40471249
correct, they are called top level domain

btw, the link is in error.  Can you take a look at it
0
 

Author Comment

by:al4629740
ID: 40471250
But I see your point anyways.  You are right, domain names do not exceed 63 characters.  So validation only needs to occur at that maximum 63 and at least 2 minimum
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471252
Does the 63 include ".com", etc?
0
 

Author Comment

by:al4629740
ID: 40471256
I believe not
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471257
I'm calling it a night and I may not have a lot of time tomorrow but I won't abandon you.
0
 

Author Comment

by:al4629740
ID: 40471261
Thanks Martin.  I'm patient : )
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40471682
It didn't take as long as I thought it would. This update includes:
Allow Enter to be used to signal completion of the Add Record process
Corrected a bug where when the user changes his mind about adding a new record and presses Esc, a blank record results
Added more website name validations
Disabled some buttons when appropriate
Added a caption to the form
Improved the unsaved changes warning
Here's a heads-up on the last one. The old message which was this
oldbothered me since it was added because it was worded awkwardly and I thought a little confusingly, so I changed it to this. I hope you approve but if not it's easy to undo. Note that the buttons now do the opposite of what they did before.
newQ-28571318-2.zip
0
 

Author Comment

by:al4629740
ID: 40471696
I will try it when I get home later today.  Thank you
0
 

Author Comment

by:al4629740
ID: 40471990
Martin.  Great changes!

I noticed one thing.  When I add a record and then change my mind by pushing Esc, then all the buttons are remain disabled and lock me out from doing anything.

See if you get the same issue.  Maybe I'm doing something wrong.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472045
You're probably right. Be back later.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472068
Mia culpa. I made the command button changes at the last minute and obviously didn't fully test.
Q-28571318-3.zip
0
 

Author Comment

by:al4629740
ID: 40472077
gratias ago tibi
0
 

Author Comment

by:al4629740
ID: 40472079
I reluctantly want to ask for another correction because I would rather just open another question.  

When selecting more than one site using the shift key, I attempt to delete multiple records and get an error.  I think it might be good to just only allow one site to be deleted at a time and this will simplify things.  Should I open another question?

Again thank you for your persistence and help.  You have gone above and beyond.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472085
Let me think about this for a while.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472115
There's no built-in way to limit the number of selected rows to one. I've seen some code on the web that purports to do that but I haven't used any of them and I don't know if they would affect the existing code. There is also no built-in way to know how many rows are selected but I've seen and used code that will allow that to be determined. So we can either try to limit the selection to one row or attempt to allow multiple, contiguous, rows to be deleted. If the latter is your choice then I'd prefer a new question, if you choose the former then I can do it here or in a new question. In either case  (and even if we do neither) we probably should delete the header in the output file if after deletions it has no more websites under it, right?
0
 

Author Comment

by:al4629740
ID: 40472124
Deleting one row would be easier and probably cleaner.

Yes, the header could go away, but could also remain to see that there was history there before.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472206
Okay so if you accidentally or on purpose select more than one row how do you want it handled? I  could just reject the selection and say essentially "try again" or I could tell you that I recognize that you've selected more than one but that I'm only going to delete the first one, or...?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:al4629740
ID: 40472476
Maybe just a message box that says, "only one website can be selected at a time"
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472548
In addition to the message I coded it so that the program continues with the deletion of the first row selected. If you'd rather just make the single row selection manually then change

If intEndRow - intStartRow <> 0 Then
    MsgBox "Only one website may be selected at a time", vbInformation + vbOKOnly, "Website Selection Error"
    MSFlexGrid1.RowSel = intStartRow
    'Exit Sub
End If

Open in new window

to this in cmdDelete_Click.
If intEndRow - intStartRow <> 0 Then
    MsgBox "Only one website may be selected at a time", vbExclamation + vbOKOnly, "Website Selection Error"
    MSFlexGrid1.RowSel = intStartRow
    Exit Sub
End If

Open in new window

Q-28571318-4.zip
0
 

Author Comment

by:al4629740
ID: 40472658
Thank you Martin.  

When the "Website Selection Error" executes, after clicking OK, then  cmdDelete_Click()  still executes.  Is it possible to prevent cmdDelete_Click() from executing if the "Website Selection Error" is triggered?
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472666
When you see the "Pending Deletion" message that follows the "Website Selection Error", just click Cancel rather than OK.
0
 

Author Comment

by:al4629740
ID: 40472686
Thats true, but it might get confusing if the user sees OK as an option.  

Is there a way to prevent that from happening on cmdDelete_Click()  so that if there is more than one selection, it simply does not occur?

I think this might be another question to ask?
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472691
Change the code as I suggested in post ID: 40472548.
0
 

Author Comment

by:al4629740
ID: 40472716
Ahhh.  I should have notice that.  Thanks again!
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40472796
YW. I'd like to do one more thing before we're done. Right now the program makes note of any change that is made to the list of websites (by setting a flag) and gives a warning about unsaved changes if the flag has been set. It also however records things like starting to add a new record but changing your mind as a change, and that would result in a false warning message if that were the only "change" made.  I realized after I did that that a much better way would be to just save a list of the websites when they are initially loaded and when exiting to compare the saved list to the list that was going to be Exported, and if there's any difference display the warning. That will eliminate the false "change" that I referred to earlier. Would you like me to do that?
0
 

Author Comment

by:al4629740
ID: 40473004
Martin,  

Thanks for noticing the details.  If possible, could you please do that?  
Another question?
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40473025
Not necessary.
Q-28571318-5.zip
0
 

Author Comment

by:al4629740
ID: 40473055
Martin,

Test the project again and see if you get an error on the double click event
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40474083
My apologies. Before I fix that I have a few things I want to ask you about.
1.    If the user double-clicks a row making it blue, changes the text and then clicks the "X" (without having pressed Enter or selecting another row), should that trigger the "unsaved changes" warning?
2.    If the file contains ^(.*\.)?hsd1.il.com.comcast.net$, what do you want to see on the screen? In other words what is editable? It would be easier if it were always hsd1.il.com.comcast.net or always comcast.net. If it is the latter, is there always just one dot?
3.    California has a lot of sites like http://www.blah.ca.gov (all ending in ca.gov). If that site were in the allowed list, would it look like ^(.*\.)?blah.ca\.gov$ or would it look like  ^(.*\.)?blah\.ca.gov$? What I'm asking is if there can be more than one dot in the part following the "\" in the allowed website records.
0
 

Author Comment

by:al4629740
ID: 40485181
Martin,

I just saw your message.  Thanks for the follow up.

You made me think about another question.  Let me find out about #2 and #3 and get back to you soon on this post

Al
0
 

Author Comment

by:al4629740
ID: 40486057
Martin,

1) When I double click a row, I get an error.  Could you see it if you get an error on the double click event?

2) hsd1.il.com.comcast.net should be listed on the flexgrid.  

3)  It should actually be written as ^(.*\.)?blah\.ca\.gov$

I just learned that all regex statements should be \.  in place of .
So hsd1.il.com.comcast.net above would be written also as ^(.*\.)?hsd1\.il\.comcast\.net$
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40486133
1) When I double click a row, I get an error.  Could you see it if you get an error on the double click event?
You reported that as a problem in post ID: 40473055 and in post ID: 40474083 I said I'd fix it, but before we get to that I want to clear up the design.

2) hsd1.il.com.comcast.net should be listed on the flexgrid.
I interpret that to mean that everything to the right of the question mark in all entries should be shown and editable.

So hsd1.il.com.comcast.net above would be written also as ^(.*\.)?hsd1\.il\.comcast\.net$
Does that mean the the input will be like that, or do you just want it to be written out like that?
0
 

Author Comment

by:al4629740
ID: 40486150
1) Ok

2) That is correct.  everything to the right of the question mark.

3)  The previous way works fine.  But I learned that to be exactly correct, every period to the right of question mark should be \.  instead of . when it is written back to the allowed file.

Hopefully I explained it.  Let me know if I need to clarify more.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40486156
I understand that the output should be \. but will the input be that way?
0
 

Author Comment

by:al4629740
ID: 40486164
Yes, it should be.  The original file I gave you incorrectly had it written.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40487260
This app was developed piecemeal and as a result it's messy, so I'm rewriting it. It may take me a day or two to do it and to test it thoroughly.
0
 

Author Comment

by:al4629740
ID: 40487316
Martin

Much appreciated!!!!
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40487794
It just dawned on me that the "Import" button isn't needed and that when the program starts its should  just open the file, so I'm going to delete that button.
0
 

Author Comment

by:al4629740
ID: 40487902
Good Point.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40489349
OK, here's the new version. Testing included:
Adding a record
Make sure ";ALLOW_MISCELLANEOUS_r<date>" header is added when adding a record
Make sure a header for a given day is added only once
Changing mind during add via the esc key
Adding multiple records (one at a time)
Add a record and then change it
Add a record and then delete another record
Delete a record
Try to delete more than one at the same time
Delete two records, one at a time
Change a record
Change mind during change
While I feel that I've thoroughly tested it, I encourage you to do the same. And if you do then please hold up on reporting problems until you are finished testing.
Rewrite.zip
0
 

Author Comment

by:al4629740
ID: 40489591
I will test it tonight.  I may need help on the BlockedSite form also in a separate question

Thank you!!
0
 

Author Comment

by:al4629740
ID: 40490509
Very good.  Couple issues I found after messing with it for some time.

1) When entering a website name without a top-level domain such as "test", it gives the message : This website must have a top-level domain.  But after if you click on the cell, the field accepts the invalid site as "test".  Instead can it simply stay in "blue box mode" until corrected?  Or any other way to fix it.

2) If I type add another website with the same name, it gives me the message box that I can't, but still allows the entry to be accepted after clicking OK.  Can this also stay blue until corrected?

3) If I double click a row to edit the website and then change my mind by clicking on another row, it gives me the error that this website already exists.  When I click on a different row, it correctly shows the same error again.  After that, if I double click on another row, it adds a duplicate website name. (I doubt this will be a real issue, but I'm really trying to stress test this.  The issue might be resolved by adding, "Push Esc to leave this record")

3) Export should probably say "Save Changes" instead
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40490605
Hope this does it.
Rewrite-1.zip
0
 

Author Comment

by:al4629740
ID: 40492707
LOOKING GOOD!
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40492775
That's GOOD:) Can you give me a heads up on the help you need on the BlockedSite form, and let me know how this form relates to that one?
0
 

Author Comment

by:al4629740
ID: 40492838
Sure, let me post up a new question
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now