Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have some numbers like below in textbox

9856321470,1235647809,9847562155,9563256985,8452136547

i need to check that given number between two commas is in 10 digit..
thank you.

means i want to validation that between two commas, the number has 10 digit.
if between two commas number doesn't contain 10 digit the it will give error.
Posted
Updated 20-Feb-14 22:39pm
v2
Comments
Sergey Alexandrovich Kryukov 21-Feb-14 0:20am    
This post does not even define the problem. What is one number is 10 digit, and another one is not?
More importantly, What have you tried so far?
What is the problem you face here?
—SA
dpokiya 21-Feb-14 4:41am    
i dont want to split string.
i need validation between two commas that number contains 10 digit.
Tom Marvolo Riddle 21-Feb-14 0:21am    
sorry not clear.what does it mean?
dpokiya 21-Feb-14 4:42am    
i dont want to split string.
i need validation between two commas that number contains 10 digit.
Tom Marvolo Riddle 21-Feb-14 4:47am    
please wait...


[^]
See this link..Sure will help u
If not then ask!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 21-Feb-14 0:21am    
Answered, a 5. It's a good idea not to show complete solution, but to help to learn something...
—SA
dpokiya 21-Feb-14 5:20am    
sir, i need validation weather digit of number between two commas is 10 digit or not.....
dpokiya 21-Feb-14 4:41am    
i dont want to split string.
i need validation between two commas that number contains 10 digit.
Sergey Alexandrovich Kryukov 21-Feb-14 10:54am    
No, you need something different: using your own brain, thinking. You go correct answer, now think how to apply it to validation.
Otherwise no solutions could ever help you.
—SA
dpokiya 21-Feb-14 23:47pm    
ohhhk, yesterday, got the solution
Try this:
C#
TextBox1.Text = "9856321470,123564780,9847562155,956325698,8452136547"

Dim text As String() = TextBox1.Text.Split(","C)

For i As Integer = 0 To text.Length - 1

	If text(i).Length = 10 Then
			
	ElseIf text(i).Length <> 10 Then
        //error message here
	End If
Next
 
Share this answer
 
v3
Refer this
String Split
 
Share this answer
 
Comments
dpokiya 21-Feb-14 4:41am    
i dont want to split string.
i need validation between two commas that number contains 10 digit.
Sergey Alexandrovich Kryukov 21-Feb-14 10:56am    
Why would you repeat already existing answer?
—SA

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