beautypg.com

B&B Electronics MODSCAN32 - Manual User Manual

Page 60

background image

60

Visual Basic Example


A very simple Visual Basic example project is included with the ModSim32 distribution files which
demonstrates how to access/modify data points contained within a ModSim32 document. The example
project simply updates a holding register based on a one second timer and updates a text control on the
form.

To create the project, perform the following steps:

Use the Project Framework to Browse for ModSim32.tlb

In the General Definitions:

Public m_sim As IModSim


In Form Load:

Set m_sim = CreateObject("ModSim32.Document")


On 1 second Timer:

status = m_sim.WritePoint (1, 40100, tick)

if status = 0 Then

tick = tick + 1

End If


status = m_sim.ReadPoint (1, 40100, temp)

if status = 0 Then

text1.text = temp

End If