|
-
Aug 10th, 2006, 05:17 PM
#1
Thread Starter
Frenzied Member
Removing a box??
This is my code and everything works well however there are little boxes after most lines and guess this is where someone hit the space bar after entering it on the online form??
How can I remove it??
VB Code:
ssource = Inet1.OpenURL("http://www.mysite.com/application/get_news.php?id=" & Form1.Text2.Text)
lStart = 1
lEnd = 1
sFindStart = "##"
sFindEnd = "/##"
lStart = InStr(lStart, ssource, sFindStart, vbTextCompare)
If lStart Then
lStart = lStart + Len(sFindStart)
lEnd = InStr(lStart, ssource, sFindEnd, vbTextCompare)
If lEnd > lStart Then
Body = Mid$(ssource, lStart, lEnd - lStart)
NewBody = Replace(Body, "<p>", vbCrLf)
NewBody2 = Replace(NewBody, "</p>", vbCrLf)
NewBody3 = Replace(NewBody2, "</br>", vbCrLf)
NewBody4 = Replace(NewBody3, "<br>", vbCrLf)
Text5.Text = NewBody4
'Text5.Text = Mid$(ssource, lStart, lEnd - lStart)
Else
Debug.Print "End text not found."
End If
Else
Debug.Print "Text not found."
End If
-
Aug 10th, 2006, 05:29 PM
#2
Re: Removing a box??
The box you reffer to could be the NULL character so try the following:
VB Code:
Text5.Text = Replace(NewBody4, Chr(0), "")
-
Aug 10th, 2006, 06:04 PM
#3
Thread Starter
Frenzied Member
Re: Removing a box??
No it does not fix it :-(
Any other ideas?
-
Aug 10th, 2006, 06:31 PM
#4
Re: Removing a box??
Try vbLf instead of vbCrLf:
VB Code:
NewBody = Replace(Body, "<p>", vbLf)
NewBody2 = Replace(NewBody, "</p>", vbLf)
NewBody3 = Replace(NewBody2, "</br>", vbLf)
NewBody4 = Replace(NewBody3, "<br>", vbLf)
-
Aug 10th, 2006, 06:41 PM
#5
Thread Starter
Frenzied Member
Re: Removing a box??
God no that makes it worse, thanks for the idea however :-)
-
Aug 10th, 2006, 06:43 PM
#6
Re: Removing a box??
Maybe this can help:
VB Code:
Dim newString As String * 1
newString = 'put in here the box char
Text5.Text = Replace(NewBody4, newString, "")
-
Aug 10th, 2006, 07:50 PM
#7
Re: Removing a box??
@kiwis:
did you set MultiLIne = True for your textbox?
-
Aug 10th, 2006, 08:01 PM
#8
Thread Starter
Frenzied Member
Re: Removing a box??
Hi RhinoBull,
yes I am, everything else works ie <p> and <br> it's just these [] or similiar that are showing.... it's not that though
-
Aug 10th, 2006, 08:16 PM
#9
Thread Starter
Frenzied Member
Re: Removing a box??
You can see the problem here
-
Aug 10th, 2006, 08:50 PM
#10
Re: Removing a box??
You can use Asc() function to determine ascii code and then replace that thing with empty string.
-
Aug 11th, 2006, 04:29 AM
#11
Re: Removing a box??
this should get rid of all boxes, no matter what they are
VB Code:
For i = 0 To 31
Select Case i
Case 1 To 8, 11, 12, 14 To 31
body = Replace(body, Chr(i), "")
End Select
Next
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 11th, 2006, 04:52 AM
#12
Hyperactive Member
Re: Removing a box??
Don't know if the tab char is included with the list from Westconn1, but try it as well.
VB Code:
body = Replace(body, vbTab, "")
-
Aug 11th, 2006, 04:56 AM
#13
Re: Removing a box??
tab is 9
cr is 13
lf is 10
all not included, they don't show as boxes
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 11th, 2006, 09:44 PM
#14
Thread Starter
Frenzied Member
Re: Removing a box??
 Originally Posted by westconn1
this should get rid of all boxes, no matter what they are
VB Code:
For i = 0 To 31
Select Case i
Case 1 To 8, 11, 12, 14 To 31
body = Replace(body, Chr(i), "")
End Select
Next
Will this change any number i have like "team one won 15 - 1"??
-
Aug 11th, 2006, 09:48 PM
#15
Re: Removing a box??
Only numbers 1,2,3,4,5,6,7,8,11,12 and from 14 to 31.
1 and 15 would be replaced.
-
Aug 11th, 2006, 10:37 PM
#16
Re: Removing a box??
the code above will not replace any numbers at all
it replaces characters with the ascii codes i listed, all of which display as small boxes
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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
|