Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Problem with live bindings

More
29 Jan 2014 11:13 #1696 by support
Replied by support on topic Problem with live bindings
Dear Sir,

the new build of QuickOPC 5.23 (labeled 5.23.1052.1), with the fix for your problem, is now posted in the Download area of our Web site .

Please uninstall the old version, and install the new one. The uninstallation step is highly recommended, because otherwise BOTH the old and new assemblies will be in the Global Assembly Cache (GAC), and that would only lead to confusion later down the road.

If you then open your project, you may experience that existing assembly references may not work, because they refer to a specific version that no longer exists. To resolve this, open the references project properties, click on each such reference, and in the Properties window, set Specific Version to False. Alternatively, you can remove the references add them a new.

Re

In the mean time do you have any exmaple code for winforms that describe how to subscribe to an object in winforms the "traditional way" not using the live binding.


Yes, certainly so - in the Examples solution (you can open it from the Start menu), under the WindowsForms folder, the HmiScreen project shows precisely that. It has a form with several read-only items, and a writeable item, and a "Write" button. It also shows how one can conveniently use the Tag property of any WinForms control to configure which OPC item to connect to. However, Live Binding is still better... Just for completeness, here is the relevant part of the HmiScreen form code:
private void Form1_Load(object sender, EventArgs e)
        {
            var argumentsList = new List<DAItemGroupArguments>();
            foreach (Control control in Controls)
            {
                Debug.Assert(control != null);
 
                var itemId = control.Tag as string;
                if (itemId != null)
                    argumentsList.Add(new DAItemGroupArguments("", "OPCLabs.KitServer.2", itemId, 50, control));
            }
            easyDAClient1.SubscribeMultipleItems(argumentsList.ToArray());
        }
 
        private void easyDAClient1_ItemChanged([NotNull] object sender, [NotNull] EasyDAItemChangedEventArgs e)
        {
            var textBox = e.State as TextBox;
            if (textBox != null && textBox.ReadOnly)
            {
                // ReSharper disable ConvertIfStatementToConditionalTernaryExpression
                if (e.Exception == null)
                // ReSharper restore ConvertIfStatementToConditionalTernaryExpression
                {
                    Debug.Assert(e.Vtq != null);
                    textBox.Text = e.Vtq.DisplayValue();
                }
                else
                    textBox.Text = Resources.Form1_easyDAClient1_ItemChanged____Error___;
            }
        }
 
        private void writeButton_Click(object sender, EventArgs e)
        {
            TextBox textBox = writeValueTextBox;
            var itemId = (string) textBox.Tag;
            Debug.Assert(itemId != null);
 
            easyDAClient1.WriteItemValue("", "OPCLabs.KitServer.2", itemId, textBox.Text);
        }
 
 
 
 

Best regards

Please Log in or Create an account to join the conversation.

More
29 Jan 2014 10:23 #1695 by perlor
Replied by perlor on topic Problem with live bindings
Hi!

Thanks for your reply.
In the mean time do you have any exmaple code for winforms that describe how to subscribe to an object in winforms the "traditional way" not using the live binding.

We will order your Product as sson as we can see that this is working. Either with traditional way or with live binding.

Regards
Per

Please Log in or Create an account to join the conversation.

More
28 Jan 2014 17:25 #1694 by support
Replied by support on topic Problem with live bindings
I can confirm the problem. Apparently there is a bug in the recent build. We will fix it as soon as possible, and let you know over this forum. Thank you for reporting it.

Note: The generated code is correct, i.e. you will not have to change your project to make it work. What's wrong is the internal interpretation of the bindings.

Best regards

Please Log in or Create an account to join the conversation.

More
28 Jan 2014 08:29 #1691 by perlor
Replied by perlor on topic Problem with live bindings
The code looks as follws and is in vb.net
/Per
I tried to make a new Project and just added two labels and got the same problem again.



<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.DaBinder1 = New OpcLabs.EasyOpc.DataAccess.LiveBinding.DABinder(Me.components)
Me.BindingExtender1 = New OpcLabs.BaseLib.LiveBinding.BindingExtender(Me.components)
Me.DaItemBinding1 = New OpcLabs.EasyOpc.DataAccess.LiveBinding.DAItemBinding(Me.components)
Me.DaItemBinding2 = New OpcLabs.EasyOpc.DataAccess.LiveBinding.DAItemBinding(Me.components)
CType(Me.DaBinder1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BindingExtender1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.BindingExtender1.SetBindingBag(Me.Label1, New OpcLabs.BaseLib.LiveBinding.BindingBag(New OpcLabs.BaseLib.LiveBinding.IAbstractBinding() {CType(Me.DaItemBinding1, OpcLabs.BaseLib.LiveBinding.IAbstractBinding)}))
Me.Label1.Location = New System.Drawing.Point(122, 31)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Label1"
'
'Label2
'
Me.Label2.AutoSize = True
Me.BindingExtender1.SetBindingBag(Me.Label2, New OpcLabs.BaseLib.LiveBinding.BindingBag(New OpcLabs.BaseLib.LiveBinding.IAbstractBinding() {CType(Me.DaItemBinding2, OpcLabs.BaseLib.LiveBinding.IAbstractBinding)}))
Me.Label2.Location = New System.Drawing.Point(125, 58)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(39, 13)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Label2"
'
'DaBinder1
'
Me.DaBinder1.BindingExtender = Me.BindingExtender1
'
'BindingExtender1
'
Me.BindingExtender1.OfflineEventSource.SourceComponent = Me
Me.BindingExtender1.OfflineEventSource.SourceMember = "FormClosing"
Me.BindingExtender1.OnlineEventSource.SourceComponent = Me
Me.BindingExtender1.OnlineEventSource.SourceMember = "Shown"
'
'DaItemBinding1
'
Me.DaItemBinding1.GroupParameters.RequestedUpdateRate = 1000
Me.DaItemBinding1.ItemDescriptor.BrowsePath = New OpcLabs.BaseLib.Browsing.BrowsePath(New String() {"Demo", "Ramp"})
Me.DaItemBinding1.ItemDescriptor.ItemId = "Demo.Ramp"
Me.DaItemBinding1.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
Me.DaItemBinding1.ValueTarget.TargetComponent = Me.Label1
Me.DaItemBinding1.ValueTarget.TargetMember = "Text"
'
'DaItemBinding2
'
Me.DaItemBinding2.GroupParameters.RequestedUpdateRate = 1000
Me.DaItemBinding2.ItemDescriptor.BrowsePath = New OpcLabs.BaseLib.Browsing.BrowsePath(New String() {"SimulateEvents", "ConditionState1", "ConditionName"})
Me.DaItemBinding2.ItemDescriptor.ItemId = "SimulateEvents.ConditionState1.ConditionName"
Me.DaItemBinding2.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
Me.DaItemBinding2.ValueTarget.TargetComponent = Me.Label2
Me.DaItemBinding2.ValueTarget.TargetMember = "Text"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(284, 262)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DaBinder1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BindingExtender1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents DaBinder1 As OpcLabs.EasyOpc.DataAccess.LiveBinding.DABinder
Friend WithEvents BindingExtender1 As OpcLabs.BaseLib.LiveBinding.BindingExtender
Friend WithEvents DaItemBinding1 As OpcLabs.EasyOpc.DataAccess.LiveBinding.DAItemBinding
Friend WithEvents DaItemBinding2 As OpcLabs.EasyOpc.DataAccess.LiveBinding.DAItemBinding

End Class

Please Log in or Create an account to join the conversation.

More
28 Jan 2014 07:52 #1688 by support
Replied by support on topic Problem with live bindings
Assuming that this is in C#, can you post here the InitializeComponent() designer-generated method from the XXXXForm.Designer.cs file?

There is a similar piece of code in Visual Basic - let me know if you need more instructions. Basically that's where the controls on the form are being created and assigned their initial values.

I want to check whether the code is incorrectly generated - or instead, it is correct, but incorrectly interpreted.

Thank you

Please Log in or Create an account to join the conversation.

More
27 Jan 2014 21:37 #1687 by perlor
Hi!

I just downloaded the quickopc.net and installed it on Visual studio 2010 using vb.net.

I created a live binding according to the "Getting strated guide" in a windows form
Compilation and running works fine.
I then added another label to the form and bind that to another opc- item.
When compiling and running both lables now show the same value.
Not two different values as expected.

Whats the problem. I downloaded version 5.23

Best Regards
Per

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.078 seconds