本文實例講述了vb.net操作注冊表的方法。分享給大家供大家參考,具體如下:
增加:
1
2
3
4
5 |
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey( "Software/Faxturer" , True ) Dim subkey As Microsoft.Win32.RegistryKey subkey = key.CreateSubKey( "Manu" ) subkey.SetValue( "Path" , "d:/software/sdf" , Microsoft.Win32.RegistryValueKind. String ) 'reg.SetValue("path", New String() {"d:/software/sdf","dfdf"}, Microsoft.Win32.RegistryValueKind.MultiString) |
修改:
1
2 |
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey( "Software/Faxturer" , True ) reg.SetValue( "path" , "d:/software/sdf" , Microsoft.Win32.RegistryValueKind. String ) |
刪除:
1
2 |
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey( "Software/Faxturer" , True ) key.DeleteSubKey( "Manu" ) |
查詢:
1
2
3
4
5
6 |
Dim rk As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey( "Software/ManuFaxturer" , True ) Dim s As String () = rk.GetSubKeyNames() Dim subkey As Microsoft.Win32.RegistryKey subkey = rk.OpenSubKey( "Manu" , False ) MsgBox(rk.GetValue( "Path" )) '注冊表根節(jié)點 MsgBox(subkey.GetValue( "Path" ))‘注冊表子結(jié)點 |
希望本文所述對大家vb.net程序設計有所幫助。
2015年全國職稱計算機考試教材(2007模 .. 定價:¥225 優(yōu)惠價:¥213 更多書籍 | |
全國職稱計算機考試速成過關系列套裝:W .. 定價:¥133 優(yōu)惠價:¥133.0 更多書籍 |