Visual Basic in FactoryTalk 8 Help

Zpiskun

Member
Join Date
May 2016
Location
Concord
Posts
3
I have a small application where i want to use a numeric input to change the tags for another numeric input i am referring to dynamically. I am trying to do this with the VB that is in FactoryTalk but i am getting errors however i try it.

The Code below seems like it should work but i get a compile error stating "Wrong number of arguments or invalid property assignment"


Private Sub NumericInput1_Change()
Tag = "{::[SLC5054]N216:" & NumericInput1.Value & "}"
NumericInput2.TagName = Tag
End Sub

does anyone know the correct syntax or another way to do this?
 
That's not how you write to tags. You first need to create a taggroup. Look in the help file.
 
Private Sub NumericInput1_Change()
Tag = "{::[SLC5054]N216:" & NumericInput1.Value & "}"
NumericInput2.TagName = Tag
End Sub

I'm out watching football at the minute so haven't got my laptop/code to hand but take a look on this forum, there's plenty of threads about vb in factory talk as it can be a pain. From the look of it your trying to show the value of N216:x where x is entered on the screen?
 
I'm out watching football at the minute so haven't got my laptop/code to hand but take a look on this forum, there's plenty of threads about vb in factory talk as it can be a pain. From the look of it your trying to show the value of N216:x where x is entered on the screen?

Yup That correct i want to both view and be able to change the value of N216:X. Where X is entered on the screen.
 
My first response, is do it in the PLC instead. But, what's wrong with your syntax is:
Tag = "{::[SLC5054]N216:" & NumericInput1.Value & "}"
NumericInput1.Value is not going to return a string. Convert it to a string, and it should work.
 
Ok, heres something you could try. I use this on a very simple production log to record start/stop times, product, etc..

In a production run we can transfer from many different tanks, so at the top of a page i show an overview of the last 10 transfers (total product, tanks used, etc..), when the opeator clicks the row i show the detailed information below by reopening the page with parameters: Display "Beer Main2_ProductionLog" /T0 , "Beer Main2_ProductionLog" /T1 , "Beer Main2_ProductionLog" /T2 , etc...

The detail tags then use #1
{[Process_CIP]FillerB_TransferData[#1].Detail[0].Start_Time}

In your case, when you change the value reopen the page using that value as the parameter.

I hope this makes sense :S

Edit: As for the VB you cant just change the reference/connections via vb, you could write that value to a label/text box in vb but would then have to keep updating it. The parameter option maybe the best way to go on this
 
Last edited:

Similar Topics

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,552
Hello, Im trying to learn how to use VBA with factorytalk view so i can later design displays using tags from PLCs and im having some trouble...
Replies
2
Views
3,801
from visual basic I am trying to write to a variable in factorytalk called alarm, this variable is of binary type, should not be a problem but I...
Replies
4
Views
4,051
Good morning! I've run into a stopping point with a Visual Basic task on a View Studio SE project and was wondering if anyone could point me in...
Replies
3
Views
26,954
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,383
Back
Top Bottom