Use this code to parse the maskEdit control. Once you have the values
in your
variables it will be easy for you to assign them in your database
columns:
public void parseControl(string AString)
{
if (AString.StartsWith("("))
{
int iStartChar = AString.IndexOf("(");
int iEndChar = AString.IndexOf(")");
string prefix = AString.Substring(iStartChar, iEndChar
+ 1);
string remnant = AString.Substring(iEndChar+1); //
skip the ")" mask
textBox1.Text = prefix; // or assign it
elsewhere.
textBox2.Text = remnant; // same as above.
}
}
Usage:
parseControl(maskedTextBox.Text);
Cheers!
Benj
On Mar 30, 3:07 pm, Rodimus74 <[email protected]> wrote:
> Hi,
>
> I've got a masked edit (for phone numbers). I've got to store the
> area code in a different field to the main phone number. Does anyone
> have any suggestions on an easy way to do this?
>
> e.g.
>
> (999) 000-0000
>
> (999) into field PHONEPREFIX
> 000-0000 into field PHONENUMBER
>
> Thanks in advance
> G