Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Mobile Number textbox1.

in that mobile Number user does not type the mobile number start with 0.

for that i validate the code.

C#
if(txt_mobile.Text.StartsWith = 0)
{
Label6.Text = "Enter Correct Mobile Number";
 return;
}



i written the above code but error shows as follows;

Cannot assign to 'StartsWith' because it is a 'method group'.

from my above code what is the error.
Posted
Updated 26-Dec-12 19:34pm
v2

Hi , i strongly recommend to you to check if there is any empty line in the beginin of the string

so as a result
C#
if(txt_mobile.Text.TrimStart().StartsWith("0"))
{
Label6.Text = "Enter Correct Mobile Number";
return false;
}
 
Share this answer
 
C#
if(txt_mobile.Text.StartsWith("0"))
{
Label6.Text = "Enter Correct Mobile Number";
return false;
}
 
Share this answer
 
v4

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