Click here to Skip to main content
14,332,266 members
Rate this:
Please Sign up or sign in to vote.
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.

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
Rate this:
Please Sign up or sign in to vote.

Solution 2

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

so as a result
if(txt_mobile.Text.TrimStart().StartsWith("0"))
{
Label6.Text = "Enter Correct Mobile Number";
return false;
}
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100