Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 122
  • Last Modified:

Help with retreiving partial data from Textbox

Hi,

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

Thanks,

Victor
0
vcharles
Asked:
vcharles
1 Solution
 
AndyAinscowFreelance programmer / ConsultantCommented:
s = Left(txtBox.Text, 3)

where txtBox is the name of your textbox
0
 
Mike EghtebasDatabase and Application DeveloperCommented:
Dim S As String
S = Me.TextBox1.Text
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
AndyAinscowFreelance programmer / ConsultantCommented:
You could also use the following
s = txtBox.Text.Substring(0, 3)
0
 
Dany BalianCTOCommented:
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
 
vcharlesAuthor Commented:
Thank You.
0
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now