Validate User input that is read in

Oct 23 2004 4:21 PM
I want to ask the User to enter a 6 digit code, and then use regular expression to validate it. If it is not correct, then ask User to try again. Here's the start of the code . . . can anyone offer a suggestion for looping and verifying the entry? Thank you. using System.Text.RegularExpressions; int code = 0; Console.WriteLine ("Enter 6 digit number."); code = Convert.ToInt32(Console.ReadLine()); string pattern = @"\d{6}"; //must be exactly 6 digits Regex rx = new Regex(pattern); //checks the pattern MatchCollection collection = rx.Matches(code); foreach(Match m in collection) Console.WriteLine(m); // displays entry

Answers (1)

0
Zoran Horvat

Zoran Horvat

  • 0
  • 4.5k
  • 747.5k
Jul 28 2011 3:48 AM
One of the projects is the one producing .exe file, which is in fact the application you want to deploy. Find that .exe in its bin/Release folder and there you should find numerous .dll files - those are the libraries referenced by the .exe.

What you need to include in the package is the .exe and all .dll files located in the same bin/Release directory. All other DLLs referenced by this .exe are located in GAC and need not be copied, but need be installed in GAC on the target machine. This is generally true in practice so do not bother about the possibility that some of those DLLs are missing in advance.

Zoran
Accepted Answer
0
dc stein

dc stein

  • 0
  • 25
  • 31k
Jul 28 2011 10:47 AM

Your answer is very helpful, but I still have the following additional questions:

1. Since this solutiion has alot of proejct files in it, I would thinkl there would be a deployment project setup also,would you agree?

2. What I do see in this application is the following in the default project startup file in the postbuild event  is the following:

$(SolutionDir)EnrT.PostIT\$(OutDir)\EnrT.PostIT.exe $(ConfigurationName).

Note: the startup project file is called Alluse'.

The above would translate to: c:\enr\EnrT.PostIT\bin\X86\debug\EnrT.PostIT.exe Debug. Would you think this would point to the

files that are required for deployment?

3. do you think the EnrT.PostIT project file would 'bundle' all the files I need? **Note: I do see some old documentation that there is a .bat files for the network administrator to use when installing the application on various user's desktop.

4. I pulled out the statement '$(SolutionDir)EnrT.PostIT\$(OutDir)\EnrT.PostIT.exe $(ConfigurationName' from the postbuild event since I could not get this application to compile clean. Would you have any ideas what I need to do to figure out why this statement keeps the entire application from building with no errors?