 |
|
ASP.NET , VB.NET (Registry ) เขียนเก็บค่าและอ่านค่าใน Registry Regedit ของ .NET ครับ |
|
 |
|
|
 |
 |
|
ลองดูครับ
Code (VB.NET)
Private Function getRegistry(ByVal key As String, Optional ByVal defValue As String = "") As String
Try
Dim regKey As Microsoft.Win32.RegistryKey
Dim Ret As String
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey(Application.ProductName)
regKey.Close()
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\" & Application.ProductName, True)
Ret = regKey.GetValue(key, defValue)
regKey.Close()
Return Ret
Catch ex As Exception
End Try
End Function
Private Sub SaveRegistry(ByVal Key As String, ByVal value As String)
Try
Dim regKey As Microsoft.Win32.RegistryKey
Dim Ret As String
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey(Application.ProductName)
regKey.Close()
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\" & Application.ProductName, True)
regKey.SetValue(Key, value)
Ret = regKey.GetValue(Key, "")
regKey.Close()
Catch ex As Exception
End Try
End Sub
|
 |
 |
 |
 |
Date :
2010-08-04 17:47:27 |
By :
plaman_club |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอโทษนะครับบ
มันเอาไปใช้ยังไงอะครับ
ผมลองแล้ว มันไม่ได้อะครับบ
รบกวนทีนะครับ
ขอบคุณครับบ
|
 |
 |
 |
 |
Date :
2010-12-22 18:40:45 |
By :
Chokuji |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
??
|
 |
 |
 |
 |
Date :
2011-03-02 10:49:02 |
By :
NAMDANGSODAZA |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (VB.NET)
Dim tmpLng As Integer
tmpLng = SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1&, 0&, 0&)
'Get the user's previous preference for the marquee message.
Dim pRegKey As RegistryKey = Registry.CurrentUser
pRegKey = pRegKey.OpenSubKey("Software\\Test Screen Saver")
Dim val As Object = pRegKey.GetValue("Message")
pRegKey.Close()
lblMessage.Text = val.ToString
|
 |
 |
 |
 |
Date :
2011-09-01 13:37:52 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วถ้าเอาจะให้ Getvalue ที่เป็นชนิด REG_MULTI_SZ ทำยังไงดีอ่ะครับ
|
 |
 |
 |
 |
Date :
2011-09-07 12:51:11 |
By :
Cs |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|