Solved

Help with retreiving partial data from Textbox

Posted on 2015-02-12
6
66 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

18 Experts available now in Live!

Get 1:1 Help Now