Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help with retreiving partial data from Textbox

Posted on 2015-02-12
6
Medium Priority
?
114 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 34

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
How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

 
LVL 44

Accepted Solution

by:
AndyAinscow earned 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

722 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