Sortieren von eine Textbox in VB6 (nach ascii) wie Bubblesort ohne Array nur
Hallo Liebes Foum,
wieder mal ein kleines Problem was bestimmt ziemlich leicht zu lösen ist (VB)
Ich möchte gern eine TextBox die mit einem Text befüllt ist ( http://juanjespar.dyndns.org/upload/Text.JPG )
sortieren, und zwar der reihenfolge nach wie die Zeichen in Ascii sind ( http://juanjespar.dyndns.org/upload/Sort.JPG )
Hoffe das ist gut erklärt was ich möchte.
Hier noch mein mom. Code (is eh falsch)
Schonmal ielen lieben dank an Die, die Helfen können!
sortieren, und zwar der reihenfolge nach wie die Zeichen in Ascii sind ( http://juanjespar.dyndns.org/upload/Sort.JPG )
Hoffe das ist gut erklärt was ich möchte.
Hier noch mein mom. Code (is eh falsch)
Option Explicit
Private Sub btsortieren_Click()
Dim iLauf As Integer, intZeileA As Integer, IntZeileB As Integer
Dim strText As String
Dim strTextinhalt As String
Dim Pruefen As Boolean
Dim test As Integer
strText = tbtext.Text
For iLauf = 1 To Len(strText)
Pruefen = True
intZeileA = Asc(Mid(strText, iLauf, 1))
IntZeileB = intZeileA + 1
If intZeileA < IntZeileB Then
test = Asc(Mid(strText, intZeileA, 1))
intZeileA = IntZeileB
strTextinhalt = strTextinhalt & Chr(test)
' strTextinhalt = Chr(IntZeileB) + strTextinhalt
End If
Next iLauf
tbtext.Text = strTextinhalt
End Sub
Private Sub btcancel_Click()
End
End Sub
' strTextinhalt = Chr(intZeileA)
' Chr(intZeileA) = Chr(IntZeileB)
' Chr(IntZeileB) = strTextinhalt
Schonmal ielen lieben dank an Die, die Helfen können!
Please also mark the comments that contributed to the solution of the article
Content-Key: 119072
Url: https://administrator.de/contentid/119072
Printed on: April 26, 2024 at 17:04 o'clock
2 Comments
Latest comment
Hallo JuanJespar!
Versuch es damit (weil Du ja "Bubblesort" wolltest):
Grüße
bastla
Versuch es damit (weil Du ja "Bubblesort" wolltest):
strText = tbtext.Text
'Sortieren
N = Len(strText)
For i = 1 To N - 1
For j = 1 To N - 1
If Mid(strText, j, 1) > Mid(strText, j + 1, 1) Then
Mid(strText, j, 2) = Mid(strText, j + 1, 1) & Mid(strText, j, 1)
End If
Next 'j
Next 'i
strText = Trim(strText)
'Gruppieren
i = 1
Do
If Mid(strText, i, 1) <> Mid(strText, i + 1, 1) Then
strText = Left(strText, i) & " " & Mid(strText, i + 1)
i = i + 1
End If
i = i + 1
Loop While i < Len(strText)
tbtext.Text = strText
bastla