Help with copying partial data from textbox2 to textbox1 using vb.net

Hi,

How do you remove the first  4 characters in textbox2 and copy them to textbox1 using vb.net?
Thanks,
Victor
vcharlesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
TextBox1.Text = TextBox2.Text.Substring(0, 4)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vcharlesAuthor Commented:
Hi,

How do you delete the first 4 characters in textbox2 aftet you copy them to textbox1?

Thanks,

Victor
Fernando SotoRetiredCommented:
This should remove the first four characters in TextBox2

TextBox1.Text = TextBox2.Text.SubString(4)
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

vcharlesAuthor Commented:
Thank you, will try both solutions and reply  tomorrow.
Jacques Bourgeois (James Burger)PresidentCommented:
@Fernando.

Same thing as what I suggested an hour and a half ago. You simply used a shortened syntax that I never use, because I want consistencies in the syntax whether I am retrieving data at the start, the end or in the middle of a string.
Fernando SotoRetiredCommented:
@James, yes I agree.   ;=)
vcharlesAuthor Commented:
Thank You!
vcharlesAuthor Commented:
Hi,

How do I check if the first four characters in textbox2 are +\-999 (i.e +056 or -056) ? I need to transfer the data to text box1 only if this condition applies.

Thanks,

Victor
Jacques Bourgeois (James Burger)PresidentCommented:
Not tested (sorry, no time)

If (TextBox2.Text.Substring(0, 1) = "+" OrElse TextBox2.Text.Substring(0, 1)="-" ) AndAlso IsNumeric(TextBox2.Text.Substring(1, 3))
vcharlesAuthor Commented:
Thank You.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.