Support Forums
[Help]GUID - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: [Help]GUID (/showthread.php?tid=7757)



[Help]GUID - DeHaterZ - 06-12-2010

Can Anyone give me the Code To Generate a GUID
and Make it Appear in The Textbox1
Yes, ive tried google but, seriously nothing has worked >.<
Thanks[:


RE: [Help]GUID - Fragma - 06-12-2010

Code:
Public Class Form1
Dim theGUID As String

Private Sub Button_Click
theGUID = System.Guid.NewGuid.ToString()
TextBox1.Text = theGUID
End Sub

End Class

Pretty easy..


RE: [Help]GUID - DeHaterZ - 06-12-2010

Doesnt Work =/


RE: [Help]GUID - Fragma - 06-13-2010

Works perfectly fine for me? Paste your exact code & I'll take a look.


RE: [Help]GUID - vricks - 07-04-2010

Code:
Public Class Form1
    Dim GUID As String


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        GUID = System.Guid.NewGuid.ToString()
        TextBox1.Text = GUID
End Sub
End Class
Picture:
[As Dubstep Code]
[Image: guidgen.jpg]


RE: [Help]GUID - xLeGiiT - 07-06-2010

This code will get the GUID value using a RegisteryKey

First we will import Microsoft.Win32(Put this above the class declaration):
Code:
Imports Microsoft.Win32

Now for the GUID Value code:
Code:
Dim regKey As RegistryKey
Dim GUID As String
regKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Cryptography", True)
GUID = regKey.GetValue("MachineGuid")
regKey.Close()

The GUID will be stored in the variable "GUID".