06-19-2009 09:10 AM
very true I will have to figure out away to get rid of that error
thanks elset191
06-19-2009 10:08 AM - edited 06-19-2009 10:15 AM
I wrote a little VI that tests this. There are two parts to it. One is if you wanted the username to be able to contain spaces between text. And another if you want to disallow any spaces. I did a quick test, but it may not be fully debugged. There are almost certainly other ways to do it too.
edit: I just realized that the bottom version allows a blank string to go through. So you could either check to make sure the length > 0 (which I think you already do) Or check to make sure it doesn't equal the empty constant.
06-19-2009 10:46 AM
I added some other things to is that where recommended and I still see to be getting errors I think it is because of the case structures I am using in the create a pasword and create a Ursername
here is passwordtime.6
thanks,
06-19-2009 10:54 AM - edited 06-19-2009 11:01 AM
A few quick things. When you check for length use >6, not equal to 6.
You have to or ALL of the errors. I.e. if the length i s < 6 you still let it pass because you do not or that error with the no spaces error.
If there are no spaces and the lenght is <6 the true case of the last case structure will be executed and add the new things into the arrays.
You can still enter a blank username. See my comment above.
Instead of using a for loop to index all of your usernames to search for a duplicate use Search 1D array. This will return -1 if it is not found. This will save you the trouble of indexing through possibly thousands of usernames before finding a duplicate. (Assuming the search implemented by labview is halfway decent.)
And a not functional suggestion. You don't need separate strings and submit buttons for signing in and creating. You can put these on top of (but not inside) the tab control and then just use a case structure for value of tab control to decide how to treat the inputs. Or you can use a simple boolean instead of a tab control.
06-19-2009 10:59 AM
06-19-2009 11:29 AM
06-19-2009 11:35 AM
I don't know why but I put an and instead of an or where it checks for spaces
sorry guys,
06-19-2009 11:42 AM - edited 06-19-2009 11:48 AM
When I enter a blank name in your version I get the error, but it still adds it to the array.
Instead of doing my own work at work I worked on this and cleaned it up a bit. Take a look.
06-19-2009 11:47 AM
funny it didn't do that for mine hmmmm
your code is very clean
thank you for all the help,
06-19-2009 12:25 PM - edited 06-19-2009 12:32 PM
You're welcome.
Another thing to consider is if you want your usernames/passwords to be case sensitive. If not, there are To Upper and To Lower functions you can use to make everything uniform case.
I also found another bug. Any whitespace except a space is still permitted. For example i typed asdf(enter)asdf and it was accepted. I have attached a version that fixes this (I think)