|
Private Sub Command1_Click()
'use replace function- 8-10 seconds on 1,00,000;133mhz 'pentium this can be slow ; runs out of memory with '1,000,000 characters Dim ret Dim ct As New CTimer lastbutton = "Command1" ct.start Me.RichTextBox1.text = Replace$(Me.RichTextBox1.text, "*", "0") MsgBox ct.finish & "ms", , lastButtonCaption End Sub Private Sub Command5_Click() 'use mid$ Dim ct As New CTimer Dim pos As Long Dim r$ lastbutton = "Command5" ct.start ' r$ = RichTextBox1.text 'repeatedly find position of character then replace it pos = 0 Do pos = InStr(pos + 1, r$, "*") 'If MsgBox(pos, vbYesNo) = vbNo Then Exit Sub If pos <= 0 Then Exit Do Mid$(r$, pos, 1) = "0" Loop Me.RichTextBox1.text = r$ MsgBox ct.finish & "ms", , lastButtonCaption End Sub |