Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am new to programming.

I am creating a windows form application in Visual Studio 2013

I am trying to create a textbox into which the user enters there postcode.

I need it to accept all possible UK postcode formats, using upper and/or lower case letters as well as with/without space

So far I have the following code

namespace Moondog_odering_system
{
    public partial class CustomerDetails : Form
    {
        public CustomerDetails()
        {
            InitializeComponent();
        }

        private void textBox11_TextChanged(object sender, EventArgs e)
        {
           "(([gG][iI][rR] {0,}0[aA]{2})|((([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y]?[0-9][0-9]?)|(([a-pr-uwyzA-PR-UWYZ][0-9][a-hjkstuwA-HJKSTUW])|([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y][0-9][abehmnprv-yABEHMNPRV-Y]))) {0,}[0-9][abd-hjlnp-uw-zABD-HJLNP-UW-Z]{2}))";         
        }
    }
}       

This is coming up with the following Error which I cannot work out a solution for

Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

This is assigned to line 21 which is the text above I have put in itallics

When you mouse over this code it says it is class System.String

Can anyone please provide a solution

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
306 views
Welcome To Ask or Share your Answers For Others

1 Answer

Have a look on the below links to get your problem solved.

to apply regex e-mail validation on windows form

and for UK regex http://regexlib.com/REDetails.aspx?regexp_id=2484&AspxAutoDetectCookieSupport=1


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...