hexagon logo

DropDown List Box example

Free to use and change to meet your needs.

Hope this helps someone.

Dim PCDDmisApp As Object
    Dim PCDDmisPart As Object
    Dim PCDDmisCommands As Object
    Dim PCDDmisCommand As Object

Sub Main ()
    Set PCDDmisApp = CreateObject("PCDLRN.Application")
    Set PCDDmisPart = PCDDmisApp.ActivePartProgram
    Set PCDDmisCommands = PCDDmisPart.Commands

    Dim Command As Object
'    create a list of part numbers For the drop down list

        Dim MyList$(8)
        MyList(0) = "12345"
        MyList(1) = "12346"
        MyList(2) = "12347"
        MyList(3) = "12348"
        MyList(4) = "12349"
        MyList(5) = "22345"
        MyList(6) = "22346"
        MyList(7) = "22347"
        MyList(8) = "22348"
        
        Begin Dialog DialogName1 200,184, "Part Number Selection Dialog Box"
            Text 10,10,88,22, "Select a Part  Number:"
            DropListBox 42,76,108,186, MyList$(), .DropList1$
            CancelButton 42,108,40,12
            OKButton 90,108,40,12
        End Dialog

        Dim Dlg1 As DialogName1

'       Dlg1.DropList1  =  0 this shows item (0) default In the window In the drop down list
'       You can change it To show Any item On top from Mylist()
        Dlg1.DropList1  =  0

'       If cancel button is selected, Exit Sub
        Button = Dialog(Dlg1)
        If Button = 0 Then Exit Sub 
     
        Vari = Dlg1.DropList1
      
        Set PCDDmisCommand = PCDDmisCommands.Add(ASSIGNMENT,True)
        PCDDmisCommand.Marked = True
        retval = PCDDmisCommand.PutText("Part_Num",DEST_EXPR,0)
        retval = PCDDmisCommand.PutText(mylist$(vari),SRC_EXPR,0)
        
End Sub


Parents Reply Children
No Data