hexagon logo

Set A Variable in PC-DMIS with a textbox in VB.Net

Hi guys,

I have taken on the task of automating our CMM operations, and so far I have been able to push through some of my issues but I am stumped on this one. All I want to do is have the VB program output whatever is written in a textbox into a variable on PC-Dmis.

Thanks for the help.
Matt
Parents
  • Sorry for the late response I was out for a few days.

    This is how the code sits now:
    'Set Program Variables
        Public Sub VarSet()
            Dim PCDApp, PCDPartPrograms, PCDPartProgram
            Dim PCDCommands, PCDCommand As Object
            Dim Shift As String
    
            PCDApp = CreateObject("PCDLRN.Application")
            PCDPartProgram = PCDApp.ActivePartProgram
            PCDCommands = PCDPartProgram.Commands
            PCDPartProgram = PCDApp.ActivePartProgram
            Cmds = PCDPartProgram.Commands
    
            For i = 1 To Cmds.Count
                Cmd = Cmds.Item(i)
                If Cmd.Type = "Assignment" And Cmd.GetText(DEST_EXPR, 0) = "JOBNO" Then
                    retval = Cmd.PutText(TextBox3.Text, SRC_EXPR, 0)
                End If
            Next i
    
            endForm()
        End Sub

    I am still getting errors on retval, DEST_EXPR, SRC_EXPR saying they are not declared.

    In VB.net, The change from “pcdcommands as pcdlrn.commands” to "pcdcommands as object".
Reply
  • Sorry for the late response I was out for a few days.

    This is how the code sits now:
    'Set Program Variables
        Public Sub VarSet()
            Dim PCDApp, PCDPartPrograms, PCDPartProgram
            Dim PCDCommands, PCDCommand As Object
            Dim Shift As String
    
            PCDApp = CreateObject("PCDLRN.Application")
            PCDPartProgram = PCDApp.ActivePartProgram
            PCDCommands = PCDPartProgram.Commands
            PCDPartProgram = PCDApp.ActivePartProgram
            Cmds = PCDPartProgram.Commands
    
            For i = 1 To Cmds.Count
                Cmd = Cmds.Item(i)
                If Cmd.Type = "Assignment" And Cmd.GetText(DEST_EXPR, 0) = "JOBNO" Then
                    retval = Cmd.PutText(TextBox3.Text, SRC_EXPR, 0)
                End If
            Next i
    
            endForm()
        End Sub

    I am still getting errors on retval, DEST_EXPR, SRC_EXPR saying they are not declared.

    In VB.net, The change from “pcdcommands as pcdlrn.commands” to "pcdcommands as object".
Children
No Data