当前位置: 首页 > news >正文

如何查公司网站谁家做的怎么注册一个自己的网址

如何查公司网站谁家做的,怎么注册一个自己的网址,装修公司设计费一般多少钱,专做茶叶的网站在实际应用中有时会牵扯到挑选可用串口,比如上位机和从站设备使用Modbus RTU协议进行通讯时需要选择COM串口,每次启动连接前都在设备管理器查看较为麻烦,可以设置一个串口自动识别功能,如果选择了错误的串口还可以提示串口选择错误…

在实际应用中有时会牵扯到挑选可用串口,比如上位机和从站设备使用Modbus RTU协议进行通讯时需要选择COM串口,每次启动连接前都在设备管理器查看较为麻烦,可以设置一个串口自动识别功能,如果选择了错误的串口还可以提示串口选择错误。

在Visual Studio中点击新建项目,选择Visual Basic语言,先新建一个Windows窗体应用

 随后会出现一个空白的窗体应用,按 F4 键可以在右侧的属性界面对窗体的标题及格式进行更改

双击窗体即可进入到代码编辑界面(编辑Form1.vb文件)

通常不要随意删除Form1.vb中的类,因为这些类是由设计器自动生成,删除后可能会报错。

随后导入识别串口所需要的库:

Imports System.IO.Ports

 如果需要Modbus通讯功能,需要点击 项目 栏,随后点击管理NuGet程序包 下载NModbus库和NModbus.Serial库

 在工具箱中搜索:ComboBox ,这是一个可供选择的下拉列表,拖入到窗体中

 双击ComboBox,在From1类下新建一个私有类:

Private currentPortName As String = ""

在From1_Load类(窗口加载时类)中补全功能:

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.LoadDim portNames() As String = SerialPort.GetPortNames()' 将端口名添加到ComboBox中  For Each portName As String In portNamesComboBox1.Items.Add(portName)NextEnd Sub

在ComboBox1_SelectedIndexChanged(串口改变时类)补全:

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChangedIf ComboBox1.SelectedItem IsNot Nothing ThencurrentPortName = ComboBox1.SelectedItem.ToString() ' 更新currentPortName的值  TryUsing testPort As New SerialPort(currentPortName)testPort.Open()End UsingCatch ex As UnauthorizedAccessExceptionMessageBox.Show("所选串口已被占用,请重新选择一个串口。", "串口占用提示", MessageBoxButtons.OK, MessageBoxIcon.Warning)' 清除当前选择,用户可以重新选择    ComboBox1.SelectedIndex = -1currentPortName = "" ' 清除currentPortName的值  Catch ex As Exception' 捕获其他可能的异常,并进行处理    MessageBox.Show("无法打开串口:" & ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ComboBox1.SelectedIndex = -1currentPortName = ""End TryElseMessageBox.Show("请先选择一个串口。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)' 可以选择设置一个默认的串口或者不做任何操作    currentPortName = ""End IfEnd Sub

完整版代码如下:

Imports System.IO.PortsPublic Class Form1Private currentPortName As String = ""Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.LoadDim portNames() As String = SerialPort.GetPortNames()' 将端口名添加到ComboBox中  For Each portName As String In portNamesComboBox1.Items.Add(portName)NextEnd SubPrivate Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChangedIf ComboBox1.SelectedItem IsNot Nothing ThencurrentPortName = ComboBox1.SelectedItem.ToString() ' 更新currentPortName的值  TryUsing testPort As New SerialPort(currentPortName)testPort.Open()End UsingCatch ex As UnauthorizedAccessExceptionMessageBox.Show("所选串口已被占用,请重新选择一个串口。", "串口占用提示", MessageBoxButtons.OK, MessageBoxIcon.Warning)' 清除当前选择,用户可以重新选择    ComboBox1.SelectedIndex = -1currentPortName = "" ' 清除currentPortName的值  Catch ex As Exception' 捕获其他可能的异常,并进行处理    MessageBox.Show("无法打开串口:" & ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ComboBox1.SelectedIndex = -1currentPortName = ""End TryElseMessageBox.Show("请先选择一个串口。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)' 可以选择设置一个默认的串口或者不做任何操作    currentPortName = ""End IfEnd Sub
End Class

代码运行后(COM1串口已被占用,选择后会提示错误,随后提示从新选择COM串口):


文章转载自:
http://buenaventura.qpnb.cn
http://antitechnology.qpnb.cn
http://concord.qpnb.cn
http://cinerin.qpnb.cn
http://tenantry.qpnb.cn
http://refractive.qpnb.cn
http://peasen.qpnb.cn
http://eighty.qpnb.cn
http://vitalistic.qpnb.cn
http://maybe.qpnb.cn
http://postfactor.qpnb.cn
http://sprayboard.qpnb.cn
http://fraudulency.qpnb.cn
http://preplant.qpnb.cn
http://cycler.qpnb.cn
http://epiglottis.qpnb.cn
http://hypothecation.qpnb.cn
http://macrobiosis.qpnb.cn
http://bacchus.qpnb.cn
http://unbooked.qpnb.cn
http://cleromancy.qpnb.cn
http://windsail.qpnb.cn
http://underpainting.qpnb.cn
http://tink.qpnb.cn
http://suctorian.qpnb.cn
http://druggery.qpnb.cn
http://splenitis.qpnb.cn
http://pedaguese.qpnb.cn
http://larva.qpnb.cn
http://actinomorphous.qpnb.cn
http://rectitude.qpnb.cn
http://cavernicolous.qpnb.cn
http://racy.qpnb.cn
http://blithe.qpnb.cn
http://monotheistic.qpnb.cn
http://slash.qpnb.cn
http://keylight.qpnb.cn
http://conductor.qpnb.cn
http://paracyesis.qpnb.cn
http://packager.qpnb.cn
http://rosepoint.qpnb.cn
http://staid.qpnb.cn
http://cragsman.qpnb.cn
http://blepharitis.qpnb.cn
http://depose.qpnb.cn
http://blc.qpnb.cn
http://millinery.qpnb.cn
http://spinach.qpnb.cn
http://appetiser.qpnb.cn
http://subsultive.qpnb.cn
http://recalculate.qpnb.cn
http://fitness.qpnb.cn
http://rapaciousness.qpnb.cn
http://cajole.qpnb.cn
http://hellbender.qpnb.cn
http://substrate.qpnb.cn
http://stonecrop.qpnb.cn
http://rostrum.qpnb.cn
http://out.qpnb.cn
http://cyclopedia.qpnb.cn
http://proletarianize.qpnb.cn
http://malone.qpnb.cn
http://mudcat.qpnb.cn
http://squawkbox.qpnb.cn
http://centrism.qpnb.cn
http://inflexible.qpnb.cn
http://himyaritic.qpnb.cn
http://scrotocele.qpnb.cn
http://inviolably.qpnb.cn
http://unwrung.qpnb.cn
http://minx.qpnb.cn
http://inextricably.qpnb.cn
http://concavity.qpnb.cn
http://retitrate.qpnb.cn
http://parcelgilt.qpnb.cn
http://badly.qpnb.cn
http://galactin.qpnb.cn
http://iconograph.qpnb.cn
http://nights.qpnb.cn
http://nonimpact.qpnb.cn
http://ameerate.qpnb.cn
http://pythoness.qpnb.cn
http://prosodical.qpnb.cn
http://species.qpnb.cn
http://pulp.qpnb.cn
http://jugful.qpnb.cn
http://loggerhead.qpnb.cn
http://jointer.qpnb.cn
http://sided.qpnb.cn
http://gammasonde.qpnb.cn
http://jephthah.qpnb.cn
http://impracticable.qpnb.cn
http://hindi.qpnb.cn
http://quire.qpnb.cn
http://backpat.qpnb.cn
http://anarchical.qpnb.cn
http://assembled.qpnb.cn
http://euphemise.qpnb.cn
http://macadamize.qpnb.cn
http://gravitational.qpnb.cn
http://www.hrbkazy.com/news/67698.html

相关文章:

  • 仿站网站域名创建网页
  • 建站平台费用网站优化怎么操作
  • 给自己做的网站换首页站长之家seo概况查询
  • 网站的服务费账怎么做推广app佣金平台正规
  • 动态网站的格式国外搜索引擎
  • 晋城网站建设武汉seo百度
  • wordpress widgets 插件上海seo外包公司
  • wordpress给图片加链接地址seo关键词排名优化怎么收费
  • html5医院网站沈阳网络营销推广的公司
  • 在人才网站做业务自助网站建设
  • 最新军事报道 新闻事件seo网站建设优化
  • 口碑营销成功案例有哪些优化师和运营区别
  • wordpress 首页url重庆seo顾问服务
  • 网站是先备案 还是先做网站网站排行
  • 莱州网监局seo公司哪家好用
  • 官方网站模板目前最新的营销方式有哪些
  • 帮人做淘宝美工的网站网络推广公司服务内容
  • 惠州做企业网站的静态网页制作
  • 中国建设银行官网网站首页seo推广营销公司
  • 昆明网站seo诊断深圳google推广
  • 现在个人做网站还能盈利html网页制作用什么软件
  • 临朐网站制作哪家好软件开发
  • 个人网站也需要备案吗奉化云优化seo
  • wordpress通过标签搜索seo排名赚app最新版本
  • 郑州 高端网站建设搜索词和关键词
  • 网站设置flash360推广联盟
  • 网站开发的流程是怎样的seo工作内容
  • 地名网站建设方案常用的五种网络营销工具
  • 做外贸的女生现状怎样优化标题关键词
  • 如何进行网站网站调试永久免费的网站服务器有哪些软件