|
-
Jun 27th, 2002, 11:33 AM
#1
Thread Starter
Member
LInefeed characters
Hi,
I am getting some value in a excel cell into VB textbox. The value contains some numbers such as 0, 1 etc.
With the value 0 i am also getting some carriage return and line feed characters(vertical bars). Since i have to perform some action based on the Excel cell value i need to sepearate just the numbers (i.e. 0,1 etc).
Is there a way just to seperate the numbers from those characters. I would really appreciate some help with this.
Thanks ,
Hari
-
Jun 27th, 2002, 11:41 AM
#2
Frenzied Member
Use the replace function.
VB Code:
newString = Replace(strgVariable, vbCrLf, "")
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Jun 27th, 2002, 11:45 AM
#3
Member
Not sure if this is what you are looking for, but this will return everything up to the first non number
VB Code:
for i = 1 to Len(txtBox.value)
if Not Mid(txtBox.value,i,1) like "#" Then
txtBox.value = Left(txtBox.value, i-1)
Exit For
End if
next
-
Jun 27th, 2002, 11:55 AM
#4
Thread Starter
Member
-
Jun 27th, 2002, 12:00 PM
#5
Frenzied Member
UR Welcome.
Also note that when you import/assign text from an external application/process/code, you will have a problem in differentiating, VBCRLF, VBCR, VBLF. All return as (a) pipe(s).
So use something like this
VB Code:
Private Sub Command1_Click()
strng = "Me" & vbCrLf & "My" & vbCr & "Myself" & vbLf
Text1.Text = strng
strng = Replace(strng, vbCrLf, "")
strng = Replace(strng, vbCr, "")
strng = Replace(strng, vbLf, "")
Text1.Text = strng
End Sub
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|