Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String Manipulation
Message
De
03/10/2000 10:03:11
Brad Stickley
Parker Pneumatic Div. North America
Wake Forest, Caroline du Nord, États-Unis
 
 
À
03/10/2000 09:05:39
Brad Stickley
Parker Pneumatic Div. North America
Wake Forest, Caroline du Nord, États-Unis
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00423976
Message ID:
00424018
Vues:
19
I figured it out!!


Private Sub Command1_Click()
Dim xnum As String
Dim mylen As Long
Dim Newlen As Long
Dim NewPnum As String
Dim OldPnum As String

OldPnum = Text1.Text

xnum = Right(OldPnum, 1)
If xnum = "X" Then
mylen = Len(OldPnum)
Newlen = mylen - 1
NewPnum = Left(OldPnum, Newlen)
Text1.Text = NewPnum
End If

End Sub


>I am trying to remove the letter X from a string that sometimes will appear in a text box. I am programming an automation app for a factory that sometimes has the letter X at the end of a part number. I want to strip the X off before I evaluate the part number to a database.
>
>Here is what I have tried. However, the result is only the letter X, which is what I want to get rid of. Any suggestions for this...?
>
>Thanks in advance.
>
>Private Sub Command1_Click()
>Dim xnum As String
>Dim mylen As Single
>Dim Newlen As Single
>Dim min1 As Single
>Dim NewPnum As String
>
>min1 = -1
>xnum = Right(Text1.Text, 1)
> If xnum = "X" Then
> mylen = Len(xnum)
> Newlen = mylen - min1
> NewPnum = Left(xnum, Newlen)
> Text1.Text = NewPnum
> End If
>
>End Sub
He is there and He is not Silent.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform