hexagon logo

Problems with VB.NET programs

          Good New Year, I met VB NET and PC-DMIS interaction issue, the program can run normally on VB6, and on VB Unable to run normally on NET, obtain Interop PCDLRN, I also reported an error when reading data on the corresponding version. I feel very distressed. I have PC software versions available in 2017 and 2023, which have compatibility issues. How can I solve this problem by referencing the COM project? Is there any relevant instance that can be used to obtain PCdmis related content in general reality.

Dim pcdApp As Application = CreateObject("PCDLRN.Application")
Dim pcdParts As PartPrograms = pcdApp.PartPrograms
Dim pcdPart As PartProgram = pcdApp.ActivePartProgram
Dim pcName = pcdPart.Name
MsgBox(pcName)

This is my second time working on this project. Do you have any relevant examples to provide? I am unable to run the program normally.thanks you

Parents
  • Hi  

    Can you explain further the issue you are having?

    A quick glance here I want to say that you need to do it in this order. Dim with Declaration, then you need to Set the variable.

    Sub Main
    
    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim PartName As String
    
    Set DmisApp = CreateObject("PCDLRN.Application")
    Set DmisPart = DmisApp.ActivePartProgram
    Set PartName = DmisPart.Name
    
    MsgBox(PartName)
    
    End Sub

  •  PC-DMIS version I am using is 2023, but an error occurred when I switched to the 2022 PC version. Error occurred: System exception: Unable to create FX component. Most importantly, when I switched to version 2023, I was unable to debug properly. I am using VS2022 software and the development language is VB. NET. If you have any relevant examples, can you send them to me for testing.

    Imports PCDLRN Imports PCDLRN.PCDSCANDIR1 Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim pcdApp As Application = CreateObject("PCDLRN.Application") Dim pcdParts As PartPrograms = pcdApp.PartPrograms Dim pcdPart As PartProgram = pcdApp.ActivePartProgram Dim pcName = pcdPart.Name MsgBox(pcName) End Sub End Class

Reply
  •  PC-DMIS version I am using is 2023, but an error occurred when I switched to the 2022 PC version. Error occurred: System exception: Unable to create FX component. Most importantly, when I switched to version 2023, I was unable to debug properly. I am using VS2022 software and the development language is VB. NET. If you have any relevant examples, can you send them to me for testing.

    Imports PCDLRN Imports PCDLRN.PCDSCANDIR1 Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim pcdApp As Application = CreateObject("PCDLRN.Application") Dim pcdParts As PartPrograms = pcdApp.PartPrograms Dim pcdPart As PartProgram = pcdApp.ActivePartProgram Dim pcName = pcdPart.Name MsgBox(pcName) End Sub End Class

Children