I have a Text Box that is a System::String^
, I need to confirm that this only accepts 10 digits numbers and no letters, symbols, etc. How would I implement this in C++ visual studio? Do I need to convert the contents to a std::string
first?
相关问题
- How to know full paths to DLL's from .csproj f
- how to split a list into a given number of sub-lis
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
相关文章
- How to show location of errors, references to memb
- JSP String formatting Truncate
- How to track MongoDB requests from a console appli
- Selecting only the first few characters in a strin
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- Python: print in two columns
- Copy different file to output directory for releas
Assuming this is a .NET winforms text box (since your snippet is C++/CLI), you want to set the "MaxLength" property. (Something like
TextBox^ tb = gcnew TextBox(); tb->MaxLength = 10
.)For the numbers-only part, you want to assign a delegate to the KeyDown and KeyPress events to make sure the entered character is a number. Sample Code is here: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress(v=VS.71).aspx