Reihenfolge vertauschen 3. September 2009, 18:08 Guten Tag, Ich habe einen Zahlencode (Integer), ungefähr so: SQL-Abfrage 1234567 Wie kann ich nun per Zufall die Zahlen um eine Stelle vertauschen, sodass z.B. das erscheint: SQL-Abfrage 1234657 Danke für jede Hilfe.
3. September 2009, 18:26 VB.NET-Quellcode Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim Rand As New Random Dim oldt = TextBox1.Text Dim RandNr Do RandNr = Rand.Next(TextBox1.TextLength) + 1 Loop Until RandNr > 1 TextBox2.Text = Mid(oldt, 1, RandNr - 2) & Mid(oldt, RandNr, 1) & Mid(oldt, RandNr - 1, 1) & Mid(oldt, RandNr + 1) End Sub man könnte es so machen, möglicherweise ginge es auch einfacher :) Textbox1.Text und Textbox2.text sind deine beiden Variablen Das ist meine Signatur und sie wird wunderbar sein!