Solved

Help with retreiving partial data from Textbox

Posted on 2015-02-12
6
74 Views
Last Modified: 2015-02-12
Hi,

If my textbox contains DEUX, how do I set string variable S to DEU? using VB.NET

Thanks,

Victor
0
Comment
Question by:vcharles
6 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40606358
s = Left(txtBox.Text, 3)

where txtBox is the name of your textbox
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 40606359
Dim S As String
S = Me.TextBox1.Text
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40606367
Also note this from the help files:
If used in a Windows Forms application, or any other class that has a Left property, you must fully qualify the function with Microsoft.VisualBasic.Left.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 40606374
You could also use the following
s = txtBox.Text.Substring(0, 3)
0
 
LVL 11

Expert Comment

by:Dany Balian
ID: 40606405
Dim TextToFind  as string, S as string
TextToFind = "DEUX"
Dim position as integer
position = InStr(textbox.text, TextToFind  )
Dim numofcharacters as integer
numofcharacters =3
If position >0 then
S = textbox.text.substring(position, numofcharacters)
End if
0
 

Author Closing Comment

by:vcharles
ID: 40606495
Thank You.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now