| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1917 人关注过本帖
标题:求助:用vb來實現對GPIB卡的控制
取消只看楼主 加入收藏
chenghui82
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-12-14
收藏
 问题点数:0 回复次数:2 
求助:用vb來實現對GPIB卡的控制
Option Explicit
Private Type recordtype
name As String * 8
tel_number As String * 8
post_code As String * 6
End Type
Dim person As recordtype
Dim filenum As Integer
Dim reclength As Long, recnum As Long
Private Sub cmdopen_click()
Reset
filenum = FreeFile
reclength = Len(person)
Open "address" For Random As filenum Len = reclength
recnum = LOF(filenum) \ reclength + 1
txtnum.Text = Str(recnum)
txtname.SetFocus
End Sub
Private Sub cmdput_click()
If txtname <> "" And txttel <> "" And txtpost <> "" Then
person.name = txtname.Text
person.tel_number = txttel.Text
person.post_code = txtpost.Text
Put #filenum, recnum, person
txtname.Text = ""
txttel.Text = ""
txtpost.Text = ""
recnum = recnum + 1
txtnum.Text = Str(recnum)
Else
txtnum.Text = "输入数据错,重新输入"
End If
End Sub

Private Sub cmdread_click()
Dim choice As Integer
recnum = Str(InputBox("输入记录号"))
Seek #filenum, recnum
Do While Not EOF(filenum)
txtnum.Text = Str(recnum)
Get #filenum, recnum, person
txtname.Text = person.name
txttel.Text = person.tel_number
txtpost.Text = person.post_code
choice = MsgBox("继续查看?", vbYesNo)
If choice = vbNo Then
Exit Do
End If
recnum = recnum + 1
Loop
End Sub
Private Sub cmderase_click()
Dim filenum1 As Integer, readnum As Long
Dim writenum As Long, erasenum As Long
filenum1 = FreeFile
Open "tempfile" For Random As #filenum1 Len = reclength
Label4.Caption = "删除记录号"
erasenum = Val(InputBox("输入删除记录号"))
Do While Not EOF(filenum)
readnum = readnum + 1
Get #filenum, readnum, person
If readnum <> erasenum Then
writenum = writenum + 1
Put #filenum1, writenum, person
End If
Loop
Close #filenum
Kill "address"
Close #filenum1
Name "tempfile" As "address"
txtnum.Text = Str(erasenum) & "号记录已被删除"
End Sub

Private Sub cmdend_click()
Close #filenum
End
End Sub
搜索更多相关主题的帖子: GPIB String Dim recordtype reclength 
2006-12-17 05:52
chenghui82
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-12-14
收藏
得分:0 
上面的關於GPIB的發錯了
recnum = LOF(filenum) \ reclength + 1
這句是甚麼意思啊
2006-12-17 07:08
chenghui82
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-12-14
收藏
得分:0 
londgn兄弟:
太好了,小弟我在這先謝謝了!
我的邮箱是:chenghui82@163.com
2006-12-19 23:14
快速回复:求助:用vb來實現對GPIB卡的控制
数据加载中...
 
   



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

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026103 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved