Private Function InsertChar(ByVal ch As Char, ByVal word As String, ByVal count As Integer) As String Dim strin As String Dim k As Integer k = 0 strin = String.Empty For iter = 0 To word.Length - 1 Step count Try strin = word.Insert(iter + count + k, ch) word = strin k += 1 Catch ex As Exception End Try Next Return strin End Function
Private Function InsertChar(ByVal ch As Char, ByVal word As String, ByVal count As Integer) As String Dim strin As String Dim k As Integer If word.Length Mod count = 0 Then k = 0 Else k = word.Length Mod count End If strin = String.Empty For iter = 0 To word.Length - 1 - k Step count strin &= word.Substring(iter, count) & ch Next If k = 0 Then Return strin.Substring(0, strin.Length - 1) Else Return strin & word.Substring(word.Length - 1 - k) End If End Function
Dim word As String word = InsertChar("-"c, "ABCRTGTTYGTZ" , 2)
Dim word As String word = InsertChar("-"c, "ABCRTGTTYGTZ" , 2)word est souligné :/ ne faut il pas mettre private function ou quelque chose du genre haut dessus ?
Dim word As String word = InsertChar("-"c, "ABCRTGTTYGTZ", 2)ou pour ton cas si text1 est le textbox de MAC
word = InsertChar("-"c, text1.text, 2)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questiontoto = "abracadabraetzbrasdevb6-basque" If Len(toto) Mod 2 <> 0 Then toto = toto & " " f = "@@ " For i = 1 To Len(toto) \ 3 f = f & " " & f Next MsgBox Trim(Format(toto, f))
Imports System.Management Imports System.Net.NetworkInformation.NetworkInterface Imports System.Net.NetworkInformation Public Class Form1 Public Overloads Shared Function VGA() As Integer End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load WebBrowser1.Navigate("http://www.showmyip.com/simple/") Dim readValue As String TextBox1.Text = System.Environment.MachineName 'nom du PC TextBox2.Text = System.Environment.UserName ' nom de l'utilisateur TextBox3.Text = My.Computer.Info.OSFullName ' l'O.S TextBox4.Text = My.Computer.Info.OSPlatform ' 32 ou 64 bits TextBox5.Text = My.Computer.Info.OSVersion TextBox6.Text = My.Computer.Info.InstalledUICulture.ToString ' la langue readValue = My.Computer.Registry.GetValue _ ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId", Nothing) TextBox7.Text = readValue ' le product id readValue = My.Computer.Registry.GetValue _ ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion", Nothing) TextBox8.Text = readValue ' le service pack readValue = My.Computer.Registry.GetValue _ ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString", Nothing) TextBox9.Text = readValue ' le nom du processeur TextBox10.Text = (GetGraphicsCardName()) TextBox12.Text = (My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory) / 1024 / 1024 & "GB" 'RAM Textbox13.text = getMacAddress() End Sub Private Function GetGraphicsCardName() As String ' la fonction pour la carte graph Dim GraphicsCardName = String.Empty Try Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_VideoController") For Each WmiResults As ManagementObject In WmiSelect.Get() GraphicsCardName = WmiResults.GetPropertyValue("Name").ToString If (Not String.IsNullOrEmpty(GraphicsCardName)) Then Exit For End If Next Catch err As ManagementException MessageBox.Show(err.Message) End Try Return GraphicsCardName End Function Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted TextBox11.Text = WebBrowser1.Document.Body.InnerText.ToString End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox("Info PC By Darff" & Chr(13) & " " & Chr(13) & "Enjoy :)", 64, "About") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() End Sub Function getMacAddress() Dim nics() As NetworkInterface = _ NetworkInterface.GetAllNetworkInterfaces 'Retrieves all network address's Return nics(0).GetPhysicalAddress.ToString 'This will get the actual MAC address from the address pool we generated End Function Private Function InsertChar(ByVal ch As Char, ByVal word As String, ByVal count As Integer) As String Dim strin As String Dim k As Integer If word.Length Mod count = 0 Then k = 0 Else k = word.Length Mod count End If strin = String.Empty For iter = 0 To word.Length - 1 - k Step count strin &= word.Substring(iter, count) & ch Next If k = 0 Then Return strin.Substring(0, strin.Length - 1) Else Return strin & word.Substring(word.Length - 1 - k) End If End Function Dim word As String word = InsertChar("-"c, textbox13.text, 2) End Class
toto = "abracadabraetzbrasdevb6-basque" If Len(toto) Mod 2 <> 0 Then toto = toto & " " f = "@@-" For i = 1 To Len(toto) \ 3 f = f & "-" & f Next MsgBox Mid(Format(toto, (f)), InStr(Format(toto, (f)), Left(toto, 2)))