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?

Re: Text.Substring by rowe_newsgroups

rowe_newsgroups
Thu Mar 13 09:11:47 CDT 2008

On Mar 13, 10:06 am, cmdolcet69 <colin_dolce...@hotmail.com> 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?

You are not assigning it:

mystring = mystring.Substring(mystring.Length - 3)

Thanks,

Seth Rowe [MVP]

Re: Text.Substring by Patrice

Patrice
Thu Mar 13 09:18:34 CDT 2008

This is a function that returns a new string...

--
Patrice

"cmdolcet69" <colin_dolcetti@hotmail.com> a écrit dans le message de news:
5f005d16-4e93-48a9-aca1-d987fddd70c6@n36g2000hse.googlegroups.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?



Re: Text.Substring by Armin

Armin
Thu Mar 13 09:15:50 CDT 2008

"cmdolcet69" <colin_dolcetti@hotmail.com> schrieb
> 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

RE: Text.Substring by FamilyTreeMike

FamilyTreeMike
Thu Mar 13 11:02:00 CDT 2008

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?
>

Re: Text.Substring by Andrew

Andrew
Thu Mar 13 12:08:24 CDT 2008

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



Re: Text.Substring by Cor

Cor
Thu Mar 13 12:49:38 CDT 2008

Andrew,

There is no import needed for Microsoft.VisualBasic,

It is standard in the project properties

Cor

"Andrew Morton" <akm@in-press.co.uk.invalid> schreef in bericht
news:eYsSlzShIHA.4712@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
>


Re: Text.Substring by Andrew

Andrew
Mon Mar 17 06:13:59 CDT 2008

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