VB.net 2005 读出系统所有串口
2007-11-16 14:38
274 查看
通过读取系统注册表的方法得到所有串口。
Imports Microsoft.Win32
Private Sub Formmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
On Error Resume Next
Dim comValue As String
Dim comreg As RegistryKey = Registry.LocalMachine
Dim returnValue As RegistryKey
ComboBox1.Items.Clear()
Dim hklm As RegistryKey = Registry.LocalMachine
Dim software11 As RegistryKey = hklm.OpenSubKey("HARDWARE")
'打开"HARDWARE"子健
Dim software As RegistryKey = software11.OpenSubKey("DEVICEMAP")
Dim sitekey As RegistryKey = software.OpenSubKey("SERIALCOMM")
Dim Str2() As String = sitekey.GetValueNames()
'获得当前子健下面所有健组成的字符串数组
Dim ValueCount As Integer = sitekey.ValueCount
'获得当前子健存在多少健值
Dim j As Integer
For j = 0 To ValueCount - 1
ComboBox1.Items.Add(sitekey.GetValue(Str2(j)))
'在下拉列表中加入所有健值
Next j
ComboBox1.Text = My.Settings.Default.comSetting
End Sub
Imports Microsoft.Win32
Private Sub Formmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
On Error Resume Next
Dim comValue As String
Dim comreg As RegistryKey = Registry.LocalMachine
Dim returnValue As RegistryKey
ComboBox1.Items.Clear()
Dim hklm As RegistryKey = Registry.LocalMachine
Dim software11 As RegistryKey = hklm.OpenSubKey("HARDWARE")
'打开"HARDWARE"子健
Dim software As RegistryKey = software11.OpenSubKey("DEVICEMAP")
Dim sitekey As RegistryKey = software.OpenSubKey("SERIALCOMM")
Dim Str2() As String = sitekey.GetValueNames()
'获得当前子健下面所有健组成的字符串数组
Dim ValueCount As Integer = sitekey.ValueCount
'获得当前子健存在多少健值
Dim j As Integer
For j = 0 To ValueCount - 1
ComboBox1.Items.Add(sitekey.GetValue(Str2(j)))
'在下拉列表中加入所有健值
Next j
ComboBox1.Text = My.Settings.Default.comSetting
End Sub
相关文章推荐
- vb.net 通过注册表读出系统所有串口
- C#、VB.NET将自己的程序注册到系统的右键菜单(所有文件和目录)
- VB.NET<机房收费系统个人重构版>你都学会了什么(之一)
- [VB.NET]急死!2005中如何更新数据源,老鸟帮帮手,立马揭帖
- vb.net & 文本框为空提示,一键清空文本框所有内容
- 转载-EAN13条码控件(VB.NET 2005)
- VS 2005(VB.net)的一些个人感觉不错的地方
- [转]VB.NET 的串口操作
- vb.net利用SerialPort进行读取串口操作
- vb.net 2005 打开WORD文档
- [VB.NET]程序中如何调用系统的快捷键?
- [VB.NET]vs.net 2005 打包问题
- VB.NET机房收费系统——组合查询
- [VB.NET]VB2005 中MDI窗体的剪贴板问题
- VB.Net 2005 WinFrom 文件上传程序...
- VB.NET机房收费系统之配置文件+反射
- [VB.NET源码]串口元件CFSerialClass.dll
- VB.NET 系统登录功能
- [VB.NET源码]图书管理系统
- 机房收费系统个人版——VB.NET组合查询