Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys, I want to convert the text of 5 TextBoxes to Integer using TryParse. My question is: can I use only 1 isConverted As Boolean variable to convert all 5 TextBoxes or do I have to use 5 isConverted variables?
Posted
Comments
Thava Rajan 13-Mar-15 2:54am    
i don't know what you are asking, create a separate method use that method to check whether the is a valid int

1 solution

You can do either, it's up to you:
VB
Dim v1 As Integer
Dim v2 As Integer
Dim isConverted1 As Boolean = Integer.TryParse(s1, v1)
Dim isConverted2 As Boolean = Integer.TryParse(s2, v2)
Or
VB
Dim v1 As Integer
Dim v2 As Integer
Dim isConverted As Boolean = Integer.TryParse(s1, v1) AndAlso Integer.TryParse(s2, v2)
 
Share this answer
 
Comments
TeeJay76 13-Mar-15 3:23am    
Thank you very much, I'm going to use the first solution because it looks more neat. You've helped me a lot
OriginalGriff 13-Mar-15 3:33am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900