Visual Basic at Wincc

Join Date
Jul 2006
Location
TÜRKİYE
Posts
22
dear friends...when we prepare we need visual basic codes...but itsnt same as visual basic 6.0 ...for example i cant define a variable like that...

dim box as integer
dim fener
Set fener=ScreenItems("lorry")
...
for box=1 to 5
Fener.left=Fener.left-10
next
end function
...

but editor says its wrong...:eek:
 
Last edited:
Try this:

Dim box
dim fener
Set fener=ScreenItems("lorry")

for box=1 to 5
Fener.left=Fener.left-10
Next
 
What is the exact error message and what item is it referring to?

I assume you mean the fener variable is not declared correctly.
You may have to declare it as an "object" for it to work:

Dim fener As Object

Or, it may have to be declared as the exact object you are trying to pass from the collection ScreenItems. If you are trying to pass a label declare it as such. Try it out and see.
 
Gerry M said:
What is the exact error message and what item is it referring to?

I assume you mean the fener variable is not declared correctly.
You may have to declare it as an "object" for it to work:

Dim fener As Object

Or, it may have to be declared as the exact object you are trying to pass from the collection ScreenItems. If you are trying to pass a label declare it as such. Try it out and see.

its says u cant use Integer...
 
WinCC VB scripts

If I remember correctly all variables are defined as the type "Variant" in WinCC.

That means that you can use it any way you want, at the cost of additional space in memory.


 
Try:

//Disclaimer: I don't have a developer license for WinCC here right now and haven't worked with WinCC or VB for almost a year now.

Dim Box
Box=1
Dim Fener
Set Fener=ScreenItems("lorry")

For Box=1 to 5 step 1
Fener.left=Fener.left-10
Next

//thought all of this should already be implied in the code
// (etc step 1 is the default for For...Next loops)
 
Itka said:
//Disclaimer: I don't have a developer license for WinCC here right now and haven't worked with WinCC or VB for almost a year now.


Dim Box
Box=1
Dim Fener
Set Fener=ScreenItems("lorry")

For Box=1 to 5 step 1
Fener.left=Fener.left-10
Next

//thought all of this should already be implied in the code
// (etc step 1 is the default for For...Next loops)



But with this codes lorry doesnt stop after count=5 ...loory go out the screen:sick:
 

Similar Topics

Hi, I want to give the value of an internal tag to an external tag, how can I write this in visual basic ?
Replies
1
Views
3,554
Hi, I need a calendar, the days that I mark => bit high Other days: bit is low that's what I need, can I write something in VB (OPC) or...
Replies
4
Views
4,544
Dear experts, I am want to program RS view32 with help of Microsoft visual basic (visual basic editor). But how to start I don't know,please...
Replies
10
Views
2,376
help How do I create Bidirectional Activex Connection Arrows? As per attached photo. How to Create RightoLeft Property in Visual Basic - Activex?
Replies
3
Views
1,655
I'm just trying to load from a text file into a string. I don't get why this doesn't work. Function LoadFile(FileName As String) As String()...
Replies
0
Views
1,548
Back
Top Bottom