Jump to content

Recommended Posts

Posted

Hi all,

I am a new user of VB.net on NA Omron HMI, and I need your help to solve a problem.

In my case, I have to get a HMI global variable value in VB.net, but the VariableName is in an other variable (string).

For example:

Var1=4

Var2=6

VarName="Var1"

I worked with a "SetVariable" function to modify the value of different variables, but right now I need to read the actual value, in the example values 4 and 6. 

Do you have any suggestion?


Posted (edited)

The data you are interested in is most likely derived in a PLC. The PLC is capable of Socket Services. (This is assuming the PLC is an NX or NJ.) This would require some PLC programming. 

Edited by IO_Rack
Posted
27 minutes ago, IO_Rack said:

The data you are interested in is most likely derived in a PLC. The PLC is capable of Socket Services. (This is assuming the PLC is an NX or NJ.) This would require some PLC programming. 

Thanks for your answer IO_Rack,

I am interested in the value of the HMI global variables. The access to that variables seems easy with the SetVariables(ByRef VariableName as object, Value as object). My problem is that I dont found a function like "GetVariable".

Kind regards.

 

Captura.PNG

Posted

I misunderstood your question.

I'm still a little confused. Where do you want to read it?

If you need to convert the data type, you can use VB.net functions like MyInt = Convert.ToInt32(MyText);

 

Posted
50 minutes ago, IO_Rack said:

I misunderstood your question.

I'm still a little confused. Where do you want to read it?

If you need to convert the data type, you can use VB.net functions like MyInt = Convert.ToInt32(MyText);

 

I want to read in the vb.net subroutine. I don't need to convert the string to integer, I need to get the value of the variable that the name is written in the string.

I have three variables defined in the HMI global variables:

str_prueba (as string)

m_prueba (as Integer)

m_prueba2 (as Integer)

To change the value of m_prueba and m_prueba2 I used the following code:

sub prueba

           str_prueba="m_prueba"

           setVariables(str_prueba,1)

end sub

Changing the string (str_prueba) I can access to the diferent variables and change the value of these. But, now i want to get the actual value of the variables as the same way, changing the variablename in the string.

thanks for your patience.

 

Posted (edited)
2 hours ago, panic mode said:

if i understand, the problem is not parsing the value but actually reading value

Edited by Septimer
Posted (edited)
16 hours ago, panic mode said:

and if i am not mistaken you are using NA terminal (in which case there is no VB.NET)

https://assets.omron.eu/downloads/manual/en/v3/v118_na_series_programmable_terminal_software_users_manual_en.pdf

 

I am not sure but I read that Omron NA panel works in VB.net. If it is not I am sorry I am new in this type of programing.

https://www.myomron.com/index.php?action=kb&article=1650

Any sugestion about how create "getVariable" or get variable value?

Captura.PNG

Edited by Septimer
Posted

I'm sorry that I don't understand where you wish to "Get" the variable. What do you want to do with the value?

You can make it equal to another string like this:

Sub GetMyString
    Str_MyOtherString = Str_MyString
End Sub

You can display it on the NA with a Data Display object by simply putting the variable in the Expression field. No VB.net needed.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...