16,554
社区成员
发帖
与我相关
我的任务
分享
Imports Microsoft.Win32.Registry
Public Class Form1
Dim mReg As Microsoft.Win32.RegistryKey
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
mReg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\mcs\", True)
mReg.SetValue("cnstring", "Data Source=.;Initial Catalog=tee;User Id=sa;Password=123456;")
mReg.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As String
mReg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\mcs\", True)
s = mReg.GetValue("cnstring")
mReg.Close()
MsgBox(s)
End Sub
End Class