Oppure

Loading
03/03/07 15:13
Hacker
io dico in questo modo:
(anche se è un po' rozzo può esserti utile per ora...)

'Nelle variabili globali:
dim Testo(300) as string
dim Puntatore as integer
dim Usate as integer

Nel form load inizializzi le variabili:

Puntatore=0
Usate=0

poi nell'evento Change della casella di testo devi fare un controllo:

if Usate=0 then

Testo(Puntatore)=Rtf.Text

else

if rtf.text <> Testo(Puntatore) then

if Puntatore < 100 then

Testo(Puntatore + 1)=rtf.text
Puntatore =Puntatore +1

else

Puntatore=0
Testo(Puntatore)=rtf.text

end if

end if

end if

E nel pulsante Annulla metti:

rtf.text=Testo(Puntatore -1)

questo è solo un piccolo esempio(lo so che è rozzo :)) con una minima gestione che ti devi ottimizzare e che ti ho scritto lì lì,e non ho ancora avuto tempo di provarlo...
Ultima modifica effettuata da Hacker 03/03/07 16:00
aaa
03/03/07 15:22
fin qui :k: ...nel tasto annulla cosa devo scrivere?
03/03/07 15:26
Hacker
editato,comunque provalo che io non ho tempo e dimmi se/cosa non va;)
aaa
03/03/07 15:30
quando premo Annulla mi dice così:

Run-time error '9':
Subscript out of range

e mi seleziona questo:
rtf.Text = Testo(Puntatore - 1)
Ultima modifica effettuata da 03/03/07 15:31
03/03/07 15:36
Hacker
già,prova a fare un controllo nel codice del pulsante:

if Usate=0 then

rtf.text=Testo(Puntatore)

else

rtf.text=Testo(Puntatore - 1)

end if
Ultima modifica effettuata da Hacker 03/03/07 15:39
aaa
03/03/07 15:40
mi da sempre lo stesso errore
03/03/07 16:59
P4p3r0g4
manca un usate = usate +1
Option Explicit
Dim Testo(300) As String
Dim Puntatore As Integer
Dim Usate As Integer


Private Sub Command1_Click()
rtf.Text = Testo(Puntatore - 1)
End Sub

Private Sub rtf_Change()
If Usate = 0 Then
Testo(Puntatore) = rtf.Text
[b]Usate = Usate + 1[/b]
Else

If Not rtf.Text = Testo(Puntatore) Then
If Puntatore < 100 Then

Testo(Puntatore + 1) = rtf.Text
Puntatore = Puntatore + 1

Else

Puntatore = 0
Testo(Puntatore) = rtf.Text

End If
End If
[b]Usate = Usate + 1[/b]
End If
End Sub
aaa
03/03/07 17:08
P4p3r0g4
e permettimi di aggiungere il supporto di più "annulla"
Option Explicit
Dim Testo(300) As String
Dim Puntatore As Integer
Dim Usate As Integer
[b]Dim nonazionareleventochange As Boolean[/b]

Private Sub Command1_Click()
[b]nonazionareleventochange = True
If Not Puntatore = 0 Then
If Not Testo(99) = "" Then
Puntatore = 99
End If
Else
Puntatore = Puntatore - 1
End If[/b]
rtf.Text = Testo(Puntatore)
[b]nonazionareleventochange = False[/b]
End Sub

Private Sub rtf_Change()
[b]If nonazionareleventochange = False Then[/b]
If Usate = 0 Then
Testo(Puntatore) = rtf.Text
Usate = Usate + 1
Else

If Not rtf.Text = Testo(Puntatore) Then
If Puntatore < 100 Then

Testo(Puntatore + 1) = rtf.Text
Puntatore = Puntatore + 1

Else

Puntatore = 0
Testo(Puntatore) = rtf.Text

End If
End If
Usate = Usate + 1
End If
[b]End If[/b]
End Sub
aaa