|
-
Oct 1st, 2000, 06:16 AM
#1
Thread Starter
Addicted Member
what is a good find code for rich text because im making a program and i need to find some text and i did that and i replaced it and all but now if it's not there i need to make it the text i need to place there
ex i need to find mike
found mike
ex2 nned to find me
did not find mike want to place it somewhere
WHat would we do with out Microsoft.
A lot more.
-
Oct 1st, 2000, 07:29 AM
#2
_______
<?>
Code:
'don't foget to add 2 spaces for each line
'in a richtextbox because of the cblf factor
Option Explicit
Option Compare Text
Private Sub Command2_Click()
Dim myString As String
myString = RichTextBox1.Text
If myString Like "*Mike*" Then
myString = Replace(myString, "Mike", "Replacement")
MsgBox myString
Else
'add Replace at the 24th position of the richtextbox
RichTextBox1.SelStart = 24
RichTextBox1.SelText = "Replace"
MsgBox RichTextBox1.Text
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 1st, 2000, 07:34 AM
#3
Thread Starter
Addicted Member
thanks , but i need it at a certen please in teh text box how whould i find the please.
ex - i neded to place the title
<html>
<head>
the title goes here how whould i do thing
</head>
sorry about this im not good with this text stuff
-
Oct 1st, 2000, 08:15 AM
#4
_______
<?>
Code:
Option Explicit
Option Compare Text
Private Sub Command2_Click()
If RichTextBox1.Text Like "*the title goes here how whould i do thing *" Then
RichTextBox1.Text = Replace(RichTextBox1.Text, _
"the title goes here how whould i do thing", _
"<Title>My Title Goes Here</Title>")
Else
'assuming there is nothing between the <Head> and </Head> tags put it there
Dim SearchString, SearchChar, MyPos
SearchString = RichTextBox1.Text ' search in.
SearchChar = "<Head>" ' Search for "P".
'if found MyPos will be > 0
MyPos = InStr(1, SearchString, SearchChar, 1)
If MyPos > 0 Then
RichTextBox1.SelStart = MyPos + 6
RichTextBox1.SelText = vbCrLf & "<Title>my title goes here</Title>"
End If
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 2nd, 2000, 04:17 PM
#5
Thread Starter
Addicted Member
why isnt this working i made it into a funcytion please help me
Public Sub WebWrighter_Find(Find As String, Replace As String, Search_Char As String)
If frmMain.ActiveForm.txtWebWrighter.Text Like Find Then
frmMain.ActiveForm.txtWebWrighter.Text = Replace(frmMain.ActiveForm.txtWebWrighter.Text, _
Find, _
Replace)
Else
'assuming there is nothing between the <Head> and </Head> tags put it there
Dim SearchString, SearchChar, MyPos
SearchString = frmMain.ActiveForm.txtWebWrighter.Text ' search in.
SearchChar = Search_Char ' Search for "P".
'if found MyPos will be > 0
MyPos = InStr(1, SearchString, SearchChar, 1)
If MyPos > 0 Then
frmMain.ActiveForm.txtWebWrighter.SelStart = MyPos + 6
frmMain.ActiveForm.txtWebWrighter.SelText = vbCrLf & Replace
End If
End If
End Sub
pleaaaaaase help me
[Edited by BoB on 10-02-2000 at 05:43 PM]
WHat would we do with out Microsoft.
A lot more.
-
Oct 2nd, 2000, 05:33 PM
#6
Thread Starter
Addicted Member
WHat would we do with out Microsoft.
A lot more.
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
|