Siemens and Visual Basic


Thread Starter


Free me from my confusion...Siemens MicroComputing and VB...

Has anyone done any programming with the S7-200, MicroComputing, and VB? I want to have an MDI form with child forms. Any or all of the
child forms need connections to the S7. If I put an S7 Data control on each form, I must unload when switching forms and the switching
process takes forever. How is this best structured? Thanks!
Since only one child is in foreground (working) at a time, can you not keep the data control common to the application (at the parent level).
Initialise the connection to S7 when the application starts, and unload it at specific events, or before closing the application.

If you need to identify, which child is curently communicating with S7, You can keep a common (global) variable (childNum )which will either
have the value 0, indicating that no child is alive, or the instance number of child eg childNum=5, indicating child number 5 is alive.
Simply add your control to your "main" form. Then create a public function for your read/write methods and access the the form that the control lives on. For example form1.S7Data1.ReadVariable "V10.0",TRUE,100. This will keep it simple for you, since one of the versions of MicroComputing only supports one connection you do not need to worry about
connect/disconect methods.

Hope this helps

Roger Hill
Software Geek

Sanjay Patel

Dear Friend

We have worked for communication through visual Basic for one project. If you have any critical issue let me inform, I will help u.


Sanjay Patel
Try this code in the child form:

FormName.PlcControlName = TextBox or other object.
The FormName is the parent form, where the control lives, and TextBox is on the child form. In Vb you can make a reference to any object any where in the project by doing this.
I suggest you put the control in the mdi form and make it public. The control will load when the MDI form loads ,i.e. only during startup. Your chlid forms can them access data from the public control in the mdi form.