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.

Visual Studio 2022 Won't run demo examples

More
25 Mar 2024 10:44 - 25 Mar 2024 10:44 #12682 by support
I suppose this is a simulated tag in KepWare. They have a weird behavior, at multiple fronts (see e.g.support.softwaretoolbox.com/app/answers/detail/a_id/3047 ) . It seems that each client connection may get its own, independent value. And QuickOPC is creating/disposing of the connections automatically. If you are using Kepware simulated tags, there is nothing I am going to suggest on the client side. Do not use them, in such case. Get a real tag, or a different server.
Last edit: 25 Mar 2024 10:44 by support.

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

More
23 Mar 2024 00:15 #12680 by wpawlowicz
I successfully got the ValueToMessageBox example to work, modified it to read a tag from my kepware server OK, and was able to write to another tag too. Looked good, but then I found that if I changed the value in the OPC server, if I repressed the Button1 without exiting runtime, it still had the old value. If I reran the program, worked OK once, then same issue that was not reading/writing the new value.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles Button1.Click

' Create EasyOPC-DA component
Dim easyDaClient As New OpcLabs.EasyOpc.DataAccess.EasyDAClient

' Read item value and display it in a message box
Try

Dim Myvalue As VariantType
Myvalue = easyDaClient.ReadItemValue("", "Kepware.KEPServerEX.V6", "Channel2.test.testtag")

MessageBox.Show(Myvalue)

easyDaClient.WriteItemValue("", "Kepware.KEPServerEX.V6", "Channel2.test.OutputTag", Myvalue)

Catch opcException As OpcException
MessageBox.Show($"*** {opcException.Message}")
End Try

End Sub
End Class

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

More
22 Mar 2024 19:26 #12676 by support
Hello,
thank you for the details.

I think I know understand what is happening.

Support for Visual Studio designer - including dragging the components from the Toolbox - is only supported for projects targeting .NET Framework (i.e. 4.7.2 to 4.8.1, in current QuickOPC version). But you can use QuickOPC components from .NET 6/7/8 projects as well; it is just that the additional VS Designer is not there. This is documented in the User's Guide.

So, you can either:

1) Create a .NET Framework project instead. In "Create New Project" Wizard, you will select "Windows Forms App (.NET Framework)", instead of just "Windows Forms App". If "Windows Forms App (.NET Framework)" does not appear under the available project templates, you need to go back to Visual Studio Installer and check whether .NET Framework 4.7.2+ support (targeting pack, SDK, ...) is installed in VS.

2) Or, you can keep using your Windows Forms .NET 8.0 project. And simply type in (or copy/paste) the code that works with the QuickOPC components. You need to install the OpcLabs.QuickOPC NuGet package into the project first, but from the picture you provided, it appears that you have already done that. Then, you can e.g. hook a method to a press of a button, and inside the method, place the QuickOPC code (namespace imports will need to go to the top of the file, of course).

Please let me know if this helps.

Best regards

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

More
22 Mar 2024 16:16 #12675 by wpawlowicz
I reloaded a Windows 10 VM from an install I had with nothing loaded, did all updates, reloaded Visual Studio 2022 from scratch, did all updates, then loaded the OPCLabs setup program to load QuickOPC. I confirmed the Nuget package 5.80.02 is installed (see attached)

Using the directions from your "Getting Started"

Microsoft Visual Studio created new Visual Basic project, selecting “Windows Forms App (.NET Framework)” template. using NET Framework 8.0 (only choice).

Tried to instantiate the EasyUAClient component in the form but the QuickOPC components are showing up as grayed out in the Toolbox so I cannot. (see attached)

I wanted to use your examples to work from, but I cannot get them to work either, although the QuickOPC links do show up in the Toolbox when I load them. Attached is the latest error list when trying to run the EasyOPCNetDemo.


As to items from your earlier questions/comments:

1. OK, ignored
2. not getting that error anymore, getting different one.
3. I am not trying to create a web app, just a Windows Forms app
4. .net 8.0
5. All I need to do is read and write a bunch of OPC tags. Your toolkit appears to do everything I need to do and more, but can't get anything to work. More than happy to buy your QuickOPC tools, but need to get them to work. Was trying to use your examples to find a way to do this, if there are better methods, I'm very eager to learn them.
Attachments:

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

More
21 Mar 2024 17:53 #12668 by support
Hello.
It's not quite clear to me what is happening, but I will try to provide some hints and it will possibly take us somewhere.

1. The warning "There was a mismatch between the processor architecture of the project being built "MSIL" ..." is expected, and benign. You can ignore it.

2. The error from the Visual Compiler, however, is for 0xc0000005 (Access Violation), so it is something that should not normally happen.

3. It is not clear, however, why you reporting an error "coming from the compilation of WebApplication1, when the picture attached appear to look like you are actually trying to create a Windows Forms application. What is the problem with the Windows Forms application then? If you get the error about WebApplication1 when just trying to build the Windows Forms project, Unload or remove the projects that you do not want, or create an empty solution and include just your own project in it.

4. Which .NET version are you targeting in your Windows Forms project? (open the project Properties). This is important for determining why the QuickOPC components are disabled.

5. What is the intent of the code you have provided? If you want to get a value of an OPC Item, use the ReadItemValue instead. The current code appears to be getting PropertyId 1, which is the DataType of the item. If that is what you wanted, then use "Dim propertyId As DAPropertyId = DAPropertyIds.DataType" instead.

Best regards

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

More
21 Mar 2024 15:50 #12667 by wpawlowicz
I'm trying to run the EasyOPCNetDemo in the
C:\Program Files (x86)\OPC Labs OPC Studio 2024.1\Examples-NET\VBNET\VisualStudio\WindowsForms\EasyOpcNetDemo

Clean install of Visual Studio 2022, all updates installed. Install of EasyOPC and update of NuGet packages.

When I load the demo and try and run I get the warnings and errors shown in the attached file. I was able to get the code to run once, all seemed good, then it does not work. Have tried uninstalling and reinstalling/updating both Visual Studio on EasyOPC.

I can run the actual demo program (compiled) from the install package, but not the sample code in the VS environment.

All I'm trying to do is write a simple program that will read a bunch of tags, then write the results of a computation into other tags. If I create a new VB Forms project in Visual Studio I see the QuickOPC items in the toolbox, but everything is grayed out (see attached).

From the sample it seems that all I'd need to do is

Dim value As Object = Nothing
Dim exception As Exception = Nothing


Dim propertyId As Integer = 1
Dim MachineName as string = ""
Dim ServerClass as string = "Kepware.KEPServerEX.V6"
Dim ItemID as string = "Riazzi.Crossover.Analogs.ReturnLinePressure"
Try
value = easyDAClient1.GetPropertyValue(MachineName, serverClass, itemIdTextBox.Text, propertyId)
Catch ex As OpcException
exception = ex
End Try
MsgBox (str(value02))
DisplayException(exception)
Attachments:

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

More
20 Mar 2024 01:40 #12658 by support
Cannot reproduce. Works for me, i.e. shows a form. The "exit message" you mentioned only appears to me after I exit the form. You can debug to see what is going on.

Note: Discovered an unrelated issue: The almost-final line in Form1_Load is missing a ".ToString ()" and should be
ListBox1.Items.Add(New DAQuality(qualityTest).ToString())
This piece was apparently lost when converting from C# (the same C# example has it correctly).

Regards

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

More
20 Mar 2024 00:29 #12657 by wpawlowicz
Getting better, can now load the example project and see all the controls. However get the error "The program '[2372] QualityStrings.exe' has exited with code 0 (0x0)." when I try and run in the Visual Studio environment.

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

More
19 Mar 2024 23:51 #12656 by support
Thank you.

As it turns out, the particular build (5.80.82) was not uploaded to nuget.org. Our fault. Please accept my apology.
I have uploaded it now.

Please exit Visual Studio and start again, because I am not sure whether it will pick the changes correctly otherwise.

Best regards

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

More
19 Mar 2024 23:11 #12655 by wpawlowicz
here's the error file after the rebuild
Attachments:

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

Moderators: support
Time to create page: 0.062 seconds