⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 This programs connect to Weigh scale. & shows the actual value.
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5280
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5415
   LinkTopic       =   "Form1"
   ScaleHeight     =   5280
   ScaleWidth      =   5415
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmpr 
      Caption         =   "COMPARE"
      Height          =   735
      Left            =   2880
      TabIndex        =   9
      Top             =   2400
      Width           =   1335
   End
   Begin VB.CommandButton ascval 
      Caption         =   "ASCII"
      Height          =   975
      Left            =   2880
      TabIndex        =   8
      Top             =   1440
      Width           =   1335
   End
   Begin VB.TextBox Text10 
      Height          =   495
      Left            =   3240
      TabIndex        =   7
      Top             =   3600
      Width           =   855
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   2280
      TabIndex        =   6
      Top             =   3600
      Width           =   855
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   1320
      TabIndex        =   5
      Top             =   3600
      Width           =   855
   End
   Begin VB.CommandButton commsp 
      Caption         =   "SPLIT"
      Height          =   735
      Left            =   1920
      TabIndex        =   4
      Top             =   4080
      Width           =   1695
   End
   Begin VB.Timer Timer1 
      Interval        =   500
      Left            =   1320
      Top             =   2040
   End
   Begin VB.CommandButton recieve 
      Caption         =   "ACK"
      Height          =   975
      Left            =   1800
      Picture         =   "Form1.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   2160
      Width           =   1095
   End
   Begin VB.CommandButton send 
      Caption         =   "SEND"
      Height          =   735
      Left            =   1800
      TabIndex        =   2
      Top             =   1440
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   1320
      TabIndex        =   0
      Text            =   "1250000000871310"
      Top             =   720
      Width           =   3735
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   1200
      Top             =   1440
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      CommPort        =   6
      DTREnable       =   0   'False
      Handshaking     =   1
   End
   Begin VB.Label Label1 
      Caption         =   "INPUT"
      Height          =   375
      Left            =   600
      TabIndex        =   1
      Top             =   840
      Width           =   615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a As Variant
Dim b As String
Dim w As String
Dim xyz As Object
Dim intwgt As Integer

Private Sub ascval_Click()
Text10.Text = Str$(Asc("F"))
End Sub

Private Sub cmpr_Click()
Dim cmpr As String
cmpr = Mid(Text1.Text, 11, 1)
MsgBox "" & cmpr
End Sub

Private Sub commsp_Click()
b = Mid(Text1.Text, 12, 5)
'If cmpr = "+" Then
'b = Split(Text1.Text, "+")
'ElseIf cmpr = "-" Then
'b = Split(Text1.Text, "-")
'End If
'Text2.Text = b(0)
'Text3.Text = b(1)
intwgt = b
Beep
MsgBox "Weight is:  " & intwgt & "  Gms.", vbInformation
xyz.cells(1, 1).Value = intwgt
'Text4.Text = b(2)
'Text5.Text = b(3)
'Text6.Text = b(4)
'Text7.Text = b(5)
'Text8.Text = b(6)
'Text9.Text = b(7)
'Text10.Text = b(8)
'Text11.Text = UBound(b)
End Sub

Private Sub Form_Load()
MSComm1.CommPort = 6
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
'Set xyz = CreateObject("Excel.Application")
'Call xyz.workbooks.Open(App.Path & "\om.xls")
a = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
'xyz.Visible = True
Set xyz = Nothing
End Sub

Private Sub MSComm1_OnComm()

End Sub

Private Sub recieve_Click()
On Error GoTo Errorhandler
Dim strwgdata, cmpr As String
strwgdata = MSComm1.Input
'MsgBox " " & strwgdata
cmpr = Mid(strwgdata, 12, 5)
intwgt = cmpr
MsgBox "Press weight acknowledge"
Text1.Text = intwgt
Errorhandler:
If Err.Number = 13 Then
MsgBox "Type Mismatch"
End If
End Sub

Private Sub send_Click()
MSComm1.Output = Text1.Text
End Sub

Private Sub Timer1_Timer()
'Text1.Text = MSComm1.Input
End Sub




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -