Tag Archives: TryParse

Check text data type in C#

This example shows how to use the TryParse method to check text data type. Each data type (int, float, bool, etc.) has a TryParse method attempts to parse a string and returns true if it is successful. You can use … Continue reading

Posted in strings, variables | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Use TryParse to parse values entered by the user in C#

The example Parse user-entered values in C# explains how you can use a try catch block to protect against errors when parsing values entered by the user. For example, if the user types “ten” in a TextBox where you expect … Continue reading

Posted in parsing, variables | Tagged , , , , , , , , , , , , | Leave a comment