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.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Installation, Deployment
- Visual Studio 2022 Won't run demo examples
Visual Studio 2022 Won't run demo examples
Please Log in or Create an account to join the conversation.
- wpawlowicz
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
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.
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.
- wpawlowicz
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
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.
Please Log in or Create an account to join the conversation.
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.
- wpawlowicz
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
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)
Please Log in or Create an account to join the conversation.
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())
Regards
Please Log in or Create an account to join the conversation.
- wpawlowicz
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
Please Log in or Create an account to join the conversation.
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.
- wpawlowicz
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Installation, Deployment
- Visual Studio 2022 Won't run demo examples