hexagon logo

Droplistbox value into variable

Hello and Good Morning (well it's morning here),

I have a question. As my shop has grown, and through much pain on my behalf, I have been forced to evolve my user vb form for information input in pc dmis. How does one take a value of a droplistbox and input it into a variable into pcdmis?

I know how to do a Textbox input and i know how to pull in a variable value.


This is how i'm doing it. I've tried a few things but can't seem to get it to work. Either I am left with a 0, a "0", or some funky value in my variable.

' Read In the list of employess With clock numbers
Let Count = "1"
Open EmpStrPath For Input As #1
Do While Not EOF(1)
      Line Input #1, Textline
      Count = Count + 1
Loop
Close #1
 
 ReDim EmpList$ (Count)


Let ECount = "0"


' Separate out the clock number And Employee And Put them In re-dimensioned arrays
Open EmpStrpath For Input As #1
Do While Not EOF(1)
      Line Input #1, Textline
          delimpos = instr(1, Textline, ";") ' Get delimiter
            Textline = left(Textline, delimpos - 1) ' Get text left of delimiter
        EmpList$ (ECount) = Textline
      ECount = ECount + 1
Loop
Close #1

.............. further down

Dim Oper1 As String

.............. further down

'Text For Operator Input
     'Box & Text For Operator Input
             Text 10,7,85,12, "Enter Operator :"
        DropListBox 65,5,100,100, EmpList$(), .DlistBox1

.............. further down

'Dimensions Each box Input To an assignment
   Oper1  = Dialg.DlistBox1
   Job1    = Dialg.DlistBox2

.............. further down

'Begins the Variable assignment To PCDMIS For Each COMMAND
For Each Cmd In Cmds
  If Cmd.Type = ASSIGNMENT Then
    If Cmd.GetText(DEST_EXPR,0) = "OPERATOR" Then
      bln = Cmd.PutText("""" + Oper1 + """", SRC_EXPR, 0)
        Cmd.ReDraw
    End If



So the box populates properly and displays the information I want, i just don't know how to put that information into the variable for Pc dmis.

Update : Upon execution all i receive in the associated Variable is "0".

Update : Using message boxes I verified that the information being passed is the item selected from the list ex. items listed A, B, C, D... if I would of chose C the value reported is 3. So instead of looking at the value being passed I am going to try to associate the value back to the constructed list. Will post results.

Update : Success. If i use Oper1 = EmpList$ (Dialg.DlistBox1) instead of Oper1 = Dialg.DlistBox1 it will pull the value from the associated list.

Update : Now next challenge how to write to a textfile without including the "" that surround the text. Will post results.

Update : I just switched my delimiting factor to include two ; instead of one and used the code



delimpet = instr(3, Textline, ";")
delimper = instr(1, Textline, ";")
Textline = Mid(Textline,delimper+1,delimpet-delimper-1)

End of Updates.
Parents
  • Here is a small code snippet that I've used to find and write into a comment -

    Dim app As PCDLRN.Application
    Dim part As PCDLRN.PartProgram
    Dim Cmds As PCDLRN.Commands
    Dim Cmd As PCDLRN.Command

    Set app = CreateObject("PCDLRN.Application")
    Set part = app.ActivePartProgram
    Set Cmds = part.Commands

    For Each Cmd In Cmds
    If Cmd.ID = "C1" Then
    ' MsgBox Cmd.TypeDescription
    retval = Cmd.PutText("Old Text?", COMMENT_FIELD, 1)
    End If
    Next Cmd

    End

    You might be able to use that as an example and take your listbox selection and put it into an ASSIGN command. I can elaborate if necessary. . . .
Reply
  • Here is a small code snippet that I've used to find and write into a comment -

    Dim app As PCDLRN.Application
    Dim part As PCDLRN.PartProgram
    Dim Cmds As PCDLRN.Commands
    Dim Cmd As PCDLRN.Command

    Set app = CreateObject("PCDLRN.Application")
    Set part = app.ActivePartProgram
    Set Cmds = part.Commands

    For Each Cmd In Cmds
    If Cmd.ID = "C1" Then
    ' MsgBox Cmd.TypeDescription
    retval = Cmd.PutText("Old Text?", COMMENT_FIELD, 1)
    End If
    Next Cmd

    End

    You might be able to use that as an example and take your listbox selection and put it into an ASSIGN command. I can elaborate if necessary. . . .
Children
No Data