26/03 17:15
Carlo
Dim a As String
Dim b As String
Dim c As String
Private Sub Command1_Click()
If Len(Text1.Text) = 3 Then
a = Left(Text1.Text, 1)
b = Mid(Text1.Text, 2, 1)
c = Right(Text1.Text, 1)
End If
If Len(Text1.Text) = 2 Then
a = ""
b = Left(Text1.Text, 1)
c = Right(Text1.Text, 1)
End If
If Len(Text1.Text) = 1 Then
a = ""
b = ""
c = Text1.Text
End If
Text2.Text = a
Text3.Text = b
Text4.Text = c
End Sub
in programmazione tutto è permesso
26/03 20:10
Carlo
Postato originariamente da maurizio74:
avevo pensato ad una condizione if ma non sapevo come occuparla
ci sono sempre più soluzioni ad un problema, studia questa:
Private Sub Command1_Click()
Text2.Text = ""
Text3.Text = ""
Text4.Text = Right(Text1.Text, 1)
If Len(Text1.Text) > 1 Then
Text3.Text = Mid(Text1.Text, Len(Text1.Text) - 1, 1)
If Len(Text1.Text) > 2 Then
Text2.Text = Mid(Text1.Text, Len(Text1.Text) - 2, 1)
End If
End If
End Sub
Ultima modifica effettuata da Carlo 26/03 20:30
in programmazione tutto è permesso
26/03 20:36
Carlo
Postato originariamente da nessuno:
Ora che hai chiarito il problema (che c'entrava il dato con il punto decimale all'inizio??), allora la soluzione è semplicissima
Private Sub Command1_Click()
Text2.Text = Mid(Text1.Text, 1, 1)
Text3.Text = Mid(Text1.Text, 2, 1)
Text4.Text = Mid(Text1.Text, 3, 1)
End Sub
così è al contrario
li vuole da destra.
in programmazione tutto è permesso
26/03 20:41
Anche tu hai messo nel text4 il carattere a destra
26/03 20:53
Carlo
Postato originariamente da nessuno:
Anche tu hai messo nel text4 il carattere a destra
se è ABC sulle textbox [A] [B] [C]
se è BC sulle textbox [ ] [B] [C]
se è C sulle textbox [ ] [ ] [C]
la tua versione diventa esatta così:
Private Sub Command1_Click()
t = Right(Space(3) & Text1.Text, 3)
Text2.Text = Mid(t, 1, 1)
Text3.Text = Mid(t, 2, 1)
Text4.Text = Mid(t, 3, 1)
End Sub
Ultima modifica effettuata da Carlo 26/03 21:14
in programmazione tutto è permesso