| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 114 人关注过本帖
标题:网上找的代码粘贴到VB6里面出错 请版主看一下哪儿出错
取消只看楼主 加入收藏
事业男儿
Rank: 2
等 级:论坛游民
帖 子:318
专家分:14
注 册:2007-4-25
结帖率:82.19%
收藏
 问题点数:20 回复次数:0 
网上找的代码粘贴到VB6里面出错 请版主看一下哪儿出错

VERSION 5.00
Begin VB.Form frmMain
   Caption         =   "宇电519仪表通讯"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin cmdRead
      Caption         =   "读取数据"
      Height          =   495
      Left            =   1680
      TabIndex        =   2
      Top             =   2160
      Width           =   1215
   End
   Begin VB.TextBox txtSetpoint
      Height          =   375
      Left            =   1680
      Locked          =   -1  'True
      TabIndex        =   1
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox txtDisplay
      Height          =   375
      Left            =   1680
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   600
      Width           =   1215
   End
   Begin VB.Label Label2
      Caption         =   "设定值:"
      Height          =   255
      Left            =   840
      TabIndex        =   4
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label1
      Caption         =   "显示值:"
      Height          =   255
      Left            =   840
      TabIndex        =   3
      Top             =   720
      Width           =   735
   End
   Begin MSCommLib.MSComm MSComm1
      Left            =   3600
      Top             =   240
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      CommPort        =   1
      DTREnable       =   -1  'True
      RThreshold      =   1
      RTSEnable       =   -1  'True
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdRead_Click()
    ' 初始化串口
    With MSComm1
        .Settings = "9600,n,8,1"  ' 宇电519默认通讯参数
        .PortOpen = True
    End With
   
    ' 读取显示值
    txtDisplay.Text = Format(ReadDisplayValue(MSComm1), "0.00")
   
    ' 读取设定值
    txtSetpoint.Text = Format(ReadSetpoint(MSComm1), "0.00")
   
    ' 关闭串口
    MSComm1.PortOpen = False
End Sub
搜索更多相关主题的帖子: 出错 Begin VB End Left 
3 天前 15:56
快速回复:网上找的代码粘贴到VB6里面出错 请版主看一下哪儿出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.147024 second(s), 11 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved