I want to use this code Code: Dim num_characters As Integer Dim i As Integer Dim txt1 As String = "" Dim ch As Integer Randomize() num_characters = Convert.ToDecimal(70) For i = 1 To num_characters ch = Int((26 + 26 + 10) * Rnd()) If ch < 26 Then txt1 = txt1 & Chr(ch + Asc("A")) ElseIf ch < 2 * 26 Then ch = ch - 26 txt1 = txt1 & Chr(ch + Asc("a")) Else ch = ch - 26 - 26 txt1 = txt1 & Chr(ch + Asc("0")) End If Next i Try Dim p1 As Process = Process.GetProcessesByName(Process.GetCurrentProcess().MainModule.ModuleName.Replace(".exe", "").ToLower.ToString)(0) SetWindowText(p1.MainWindowHandle, txt1) Catch ex As Exception MsgBox(ex.ToString) End Try but its not working, why is that? O_O
More simple way... Make sure you use this... Imports System.Text and place this code in your Form Load Event. Code: Dim str As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" Dim r As New Random Dim sb As New StringBuilder For i As Integer = 1 To 8 Dim idx As Integer = r.Next(0, 35) sb.Append(str.Substring(idx, 1)) Next Me.Text = sb.ToString EDIT: If you want lower case letters replace the string characters to lower case, or for a mix of upper and lower it should look like this... Code: "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789" Regards, The Dev.