• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 120
  • 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
 
AndyAinscowCommented:
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
 
AndyAinscowCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
AndyAinscowCommented:
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

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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