473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Text.Substring

Dim mystring As String
mystring = txtInputValues.Text
mystring.Substring(mystring.Length - 3)
I want my mystring to display the last 3 from the txtinputValue.text
string. What im I doing wrong?
Mar 13 '08 #1
6 4091
This is a function that returns a new string...

--
Patrice

"cmdolcet69" <co************@hotmail.coma écrit dans le message de news:
5f**********************************...oglegroups.com...
Dim mystring As String
mystring = txtInputValues.Text
mystring.Substring(mystring.Length - 3)
I want my mystring to display the last 3 from the txtinputValue.text
string. What im I doing wrong?

Mar 13 '08 #2
"cmdolcet69" <co************@hotmail.comschrieb
Dim mystring As String
mystring = txtInputValues.Text
mystring.Substring(mystring.Length - 3)
I want my mystring to display the last 3 from the txtinputValue.text
string. What im I doing wrong?
Note that SubString is a function. You are ignoring it's return value.
Armin
Mar 13 '08 #3
In addition to what the others said, make sure you add a check for the length
of mystring. You will get a runtime error if the length is less than three.

"cmdolcet69" wrote:
Dim mystring As String
mystring = txtInputValues.Text
mystring.Substring(mystring.Length - 3)
I want my mystring to display the last 3 from the txtinputValue.text
string. What im I doing wrong?
Mar 13 '08 #4
cmdolcet69 wrote:
Dim mystring As String
mystring = txtInputValues.Text
mystring.Substring(mystring.Length - 3)
I want my mystring to display the last 3 from the txtinputValue.text
string. What im I doing wrong?
Imports VB=Microsoft.VisualBasic

Dim mystring as String=VB.Right(txtInputValues.Text, 3)

Andrew
Mar 13 '08 #5
Andrew,

There is no import needed for Microsoft.VisualBasic,

It is standard in the project properties

Cor

"Andrew Morton" <ak*@in-press.co.uk.invalidschreef in bericht
news:eY**************@TK2MSFTNGP04.phx.gbl...
cmdolcet69 wrote:
> Dim mystring As String
mystring = txtInputValues.Text
mystring.Substring(mystring.Length - 3)
I want my mystring to display the last 3 from the txtinputValue.text
string. What im I doing wrong?

Imports VB=Microsoft.VisualBasic

Dim mystring as String=VB.Right(txtInputValues.Text, 3)

Andrew
Mar 13 '08 #6
Cor Ligthert[MVP] wrote:
There is no import needed for Microsoft.VisualBasic,

It is standard in the project properties
I tend to do that because it's easier to qualify it as VB.Right rather than
Microsoft.VisualBasic.Right. Otherwise the VB compiler in VS2003 can see it
as a window/form property rather than the Right string function from VB. (Or
maybe it only does that with Left, but for symmetry I do it with Right too.)

Andrew
Mar 17 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
2
by: Karen Sullivan | last post by:
Hi, all. I'm fairly new to SQL, and I have been trying to create a table from a text file. I have been looking at this for days, and can't find the problem. I get a syntax error " Line 55:...
9
by: lkrubner | last post by:
I've got a function, you can see it below, that is being called onmouseup in the textarea on my main form. The idea is to find a selection if possible and store that text in a global variable. I...
3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
3
by: excel_hari | last post by:
Hi, I couldnt locate a Classic ASP group hence posting here. One of my colleagues has designed an intranet site and one of the pages has a drop-down box with close to 300 options. I want to...
2
by: rigamonk | last post by:
I have a form that runs a procedure when a button is clicked. the procedure does a few things, then outputs the results to labels on a form....which it does fine. However, when I call that...
0
by: samjam | last post by:
Below is some coding in a program i am using, i would like to know how i can get the text bigger or bolder on my webpage, This is the section of text i would like bigger or bolder (This is a very...
1
by: eBob.com | last post by:
After a lot of debugging effort I have to conclude that it does. Or at least can. I take a substring (RichTextBox.Text.Substring) before setting SelectionStart and after and get a different...
9
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to open a text file and format it into a specific line and then apply color to a specific location of the text and then display it in a RichTextBox after all of this is done. I can do all...
1
by: CAM123 | last post by:
I have added: <br><xsl:value-of select="Line" /></br> to my XSLT stylesheet to get a line per repeating block. When I view the output as XML it looks perfect - one line per block. However...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.