Clearing a text field on RSView32 using VB code

J

Thread Starter

jorge nieves

Hi,

I'm currently using an RSView32 application where I have fields that upon pressing a button on the screen need to be cleared. How do I implement VB code to clear the text fields?

Text is entered into a textbox on a RSView32 screen. A button is pressed by the user and a validation of the text entered into the field is performed using VB code. After the comparison is made I need to clear the values entered into the text box. How do I get access to the text box properties from VB so I can clear its value?
 
H
Associated with every String Input object is a HMI tag of type string. A Tag object can be accessed in VB code by defining a variable of type Tag (e.g. Dim mTag As Tag) and creating an instance of the tag object (set mTag = gTagDb.GetTag("Tag Name")), where Tag Name is the name of the Tag defined in the Tag Database. After the variable instance is created the ".value" attribute of the mTag object is used to access the contents. So you could clear check the contents by using a string compare function or whatever is suitable and/or clear the tag value by setting Mtag.Value = "". Listed below is a simple example

Public Sub Test()
Dim mTag As Tag

Set mTag = gTagDb.GetTag("Stag1")
If Not (mTag Is Nothing) Then
If StrComp(mTag.Value, "NEW") = 0 Then
mTag.Value = ""
Else
MsgBox "Enter New Data"
End If
Set mTag = Nothing
End If

End Sub
 
Top