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?
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)
0

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
0
Fernando SotoRetiredCommented:
This should remove the first four characters in TextBox2

TextBox1.Text = TextBox2.Text.SubString(4)
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

vcharlesAuthor Commented:
Thank you, will try both solutions and reply  tomorrow.
0
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.
0
Fernando SotoRetiredCommented:
@James, yes I agree.   ;=)
0
vcharlesAuthor Commented:
Thank You!
0
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
0
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))
0
vcharlesAuthor Commented:
Thank You.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.