Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 259

10F. Visual Basic
II. SOFTWARE GUIDES - 10. Driver488/W31
II-244
Personal488 User’s Manual, Rev. 3.0
Posting Link Information with Focus
If your application has several text boxes from which DDE information can be sourced, you will want
to allow your Copy Link control to post the name of the text box that presently has the Focus.
To do this, here is one way:
1.
Declare a global string called
CtrlName
as a storage space for the name of the text box that
presently has the Focus.
2.
Under the
GotFocus
event for each of the text boxes, type the following commands:
Sub Text1_GotFocus()
CtrlName = “text1"
CopyLink.Enabled = TRUE
End Sub
Sub Text2_GotFocus()
CtrlName = “text2"
CopyLink.Enabled = TRUE
End Sub
Sub Text3_GotFocus()
CtrlName = “text3"
CopyLink.Enabled = TRUE
End Sub
These service routines will maintain the global variable
CtrlName
with the name of the presently
selected text box. They also allow user access to your Copy Link button.
3.
Under the
LostFocus
event for each of the text boxes, type the following commands:
Sub Text1_LostFocus()
CtrlName = “text1"
CopyLink.Enabled = FALSE
End Sub
Sub Text2_LostFocus()
CtrlName = “text2"
CopyLink.Enabled = FALSE
End Sub
Sub Text3_LostFocus()
CtrlName = “text3"
CopyLink.Enabled = FALSE
End Sub
These service routines will disable user access to your Copy Link control when no text boxes have
the Focus.
4.
In your Copy Link service routine, type the following:
Sub CopyLink_Click ()
ClipBoard.Clear
ClipBoard.SetText “PROJECT1|Form1!” + CtrlName, &HBF00
End Sub
This service routine will post the name of the text box that presently has the Focus. When you
move to the Excel spreadsheet and perform a Paste Link, the proper text box specification will
appear.
Acquisition Engine
One of the most common DDE applications in the data acquisition world, is sending collected data
from an instrument directly to a spreadsheet or analysis package.
Since spreadsheets and analysis programs typically do not have any means by which to setup
instruments and collect data, an independent program must be written to perform those functions,
namely, the Acquisition Engine. Using Driver488/W31, we will write a program that controls the 16-
channel digitizer, the ADC488/16A.