WSMBT Quick start guide

How to add the WSMBT control to the toolbox:

  1. On the Tools menu, click Choose Toolbox Items.

    Choose toolbox item


  2. Click browse. The open dialog appears.

    Browse


  3. Browse for the wsmbt.dll

    Select DLL


  4. Click ok in the "Choose toolbox Items" dialog box.

    Select control


  5. Now you can find the WSMBT control in the toolbox.

    WSMBT in toolsbox


  6. Add the WSMBTControl to your form like you add a timer.

Example code how to make a connection.

WSMBT.Result Result;
wsmbtControl1.Mode = WSMBS.Mode.TCP_IP;
wsmbtControl1.ResponseTimeout = 1000;
wsmbtControl1.ConnectTimeout = 1000;
Result = wsmbtControl1.Connect("127.0.0.1", 502);
if (Result != WSMBT.Result.SUCCESS)
  MessageBox.Show(wsmbtControl1.GetLastErrorString());

Example code to read 10 holding registers.

Int16[] Registers = new Int16[10];
WSMBT.Result Result;
Result = wsmbtControl1.ReadHoldingRegisters(1, 0, 10, Registers);
if (Result != WSMBT.Result.SUCCESS)
   MessageBox.Show(wsmbtControl1.GetLastErrorString());