Option Explicit
Public I As Integer
Private Sub DisabilitaTasti()
cmdSost.Enabled = False
cmdTrovaSucc.Enabled = False
cmdSostAll.Enabled = False
End Sub
Private Sub cddTrovaSucc_Click()
Do Until Mid(Writer, I, Len(Sost.Text)) = Sost.Text And (Len(Writer) - Len(Sost.Text) + 1)
I = I + 1
If Mid(Writer, I, Len(Sost.Text)) = Sost.Text Then Trova
Loop
End Sub
Private Sub cmdFine_Click()
EndSost = True
Me.Hide
End Sub
Private Sub cmdSostAll_Click()
Dim testo1, testo2 As String
For I = 1 To Len(Writer) - Len(Sost.Text) + 1
If Mid(Writer, I, Len(Sost.Text)) = Sost.Text Then
testo1 = Left(Writer, I - 1)
testo2 = Right(Writer, Len(Writer) - I - Len(Sost.Text) + 1)
Writer = testo1 & NewSost.Text & testo2
Me.Caption = Writer
EndSost = True
End If
Next I
If EndSost = False Then MsgBox """" & Sost & """" & " non trovato", vbOKOnly, "Blocco Note"
End Sub
Private Sub Form_Load()
DisabilitaTasti
I = 0
End Sub
Private Sub Sost_Change()
If Sost.Text = "" Then DisabilitaTasti
If Sost.Text <> "" Then
cmdSost.Enabled = True
cmdSostAll.Enabled = True
cmdTrovaSucc.Enabled = True
End If
End Sub