Drop Down Box

Walleye Angler
Participant
Participant
Posts: 7
Joined: Tue Nov 27, 2012 11:04 am

Drop Down Box

Post by Walleye Angler » Tue Nov 27, 2012 11:26 am

I am using MeasureMax software with VB 5.0

Can I make a drop down box form and then use the selected information in my modmain program? For example: I have similar part numbers 123-A, 123-B, & 123-C and I would like to have these in a dropdown box then use Case Select or a similar means to run the program per the selected part.

I have made the drop down box but cannot succesfully recall the selected info in my main program.

User avatar
US_Helpdesk
Moderator
Moderator
Posts: 1087
Joined: Wed Feb 23, 2011 7:26 pm

Re: Drop Down Box

Post by US_Helpdesk » Tue Nov 27, 2012 4:50 pm

Hi... I've attached a sample Project File that illustrates the function you're trying to achieve. You can use a Select Case statement to control what portion of the program is executed. You could also perform some math in VB and then recall variable values into measured features or report items using the Set Variable button. You will see the Set Variable button in the Nominal Tab of various feature and report operations.

See Code:

Code: Select all

Dim MyList$ (11)
	MyList (0) = "line Item A"
	MyList (1) = "line Item B"
	MyList (2) = "line Item C"
	MyList (3) = "line Item D"
	MyList (4) = "line Item E"

Begin Dialog DlgProgSelect 167,21, 199, 200, "Program Selection"
  PushButton 28,152,60,28, "OK"
  PushButton 92,152,60,28, "Cancel"
  CheckBox 88,76,80,12, "Run Sub-Routine?", .CheckBox_1
  DropListBox 84,96,88,80, MyList$( ), .DropDown_1
End Dialog


Dim dlg as DlgProgSelect
Dim BtnCmd as Integer


AA:
BtnCmd=Dialog(dlg)
If BtnCmd=3 Then

Goto AA
End If
If BtnCmd=2 Or BtnCmd=0 Then
   i=Msgbox("Are you sure you want to Exit?",33, "Exit Program")
   If i=1 Then
      End
   Else
      Goto AA
   End If
End If


'msgbox dlg.DropDown_1
'msgbox dlg.CheckBox_1

MyStep = dlg.DropDown_1
DoSelect = dlg.CheckBox_1

If DoSelect = "1" Then

Select Case MyStep
Case "0"
GoTo A
Case "1"
Goto B
Case "2"
Goto C
Case "3"
Goto D
Case "4"
Goto E
End Select

End If

A:

MsgBox("A")

If DoSelect = "1" Then
GoTo MyEnd
End If

B:

MsgBox("B")

If DoSelect = "1" Then
GoTo MyEnd
End If

C:

MsgBox("C")

If DoSelect = "1" Then
GoTo MyEnd
End If

D:

MsgBox("D")


If DoSelect = "1" Then
GoTo MyEnd
End If

E:

MsgBox("E")

If DoSelect = "1" Then
GoTo MyEnd
End If

MyEnd:

See attached file...
You do not have the required permissions to view the files attached to this post.
I've migrated to a new user account, see my other posts here

Walleye Angler
Participant
Participant
Posts: 7
Joined: Tue Nov 27, 2012 11:04 am

Re: Drop Down Box

Post by Walleye Angler » Wed Nov 28, 2012 8:22 am

I was unable to open the file to see your example. Is there another way to show me or explain? Thanks, I appreciate the help.

Mike

Walleye Angler
Participant
Participant
Posts: 7
Joined: Tue Nov 27, 2012 11:04 am

Re: Drop Down Box

Post by Walleye Angler » Wed Nov 28, 2012 11:52 am

I have been getting around this by using an Input Box. The trouble I have with it is when it comes up it is behind prompt monitor and throws the operators for a loop because they can't find the input box. When doing it this way I feel there is risk of an operator miss typing the information.

User avatar
US_Helpdesk
Moderator
Moderator
Posts: 1087
Joined: Wed Feb 23, 2011 7:26 pm

Re: Drop Down Box

Post by US_Helpdesk » Wed Nov 28, 2012 2:39 pm

The project file I attached was from CMMM version 3.2. You will need 3.2 or later to open the file.

I edited the previous post to include the VB Code I used in the project.
When doing it this way I feel there is risk of an operator miss typing the information.
You can validate values in an InputBox as shown here:

Code: Select all

Do Until myLoop > 0 And myLoop < 1000 
   myLoop = InputBox("Please Enter number of loops")
      If myLoop > 0 And myLoop < 1000 Then
      Else
         MsgBox("Please enter a value between 1 and 999")
      End If
   Loop


I've migrated to a new user account, see my other posts here

Walleye Angler
Participant
Participant
Posts: 7
Joined: Tue Nov 27, 2012 11:04 am

Re: Drop Down Box

Post by Walleye Angler » Wed Jun 12, 2013 9:13 am

Due to my very limited knowledge of VB you lost me with the "Begin Dialog". Could you explain this? I am still unable to transfer my information to my modmain program. Here is what I have in my modmain program:

Dropdown1.Show 0
Unload Dropdown1
Dropdown1.Show 1

Dim PARTLENGTH
Select Case DASHNO <<<< This always causes an error saying DASHNO is not defined >>>>
Case 20
CrtData "@30261-020 was selected@"
PARTLENGTH = 1.125
GoTo DASHNOSET
Case 23
CrtData "@30261-023 was selected@"
PARTLENGTH = 1.25
GoTo DASHNOSET
Case 25
CrtData "@30261-025 was selected@"
PARTLENGTH = 1.375
GoTo DASHNOSET
Case 30
CrtData "@30261-030 was selected@"
PARTLENGTH = 1.5
GoTo DASHNOSET
Case 32
CrtData "@30261-032 was selected@"
PARTLENGTH = 1.625
GoTo DASHNOSET
End Select


<<<<<<<<<<<<< Dropdown1 code in form >>>>>>>>>>>>>>>>
Private Sub Form_Load()
List1.AddItem ("30261-020")
List1.AddItem ("30261-023")
List1.AddItem ("30261-025")
List1.AddItem ("30261-030")
List1.AddItem ("30261-032")
End Sub
----------------------------------------------------------------------------------------------------------

Private Sub Command1_Click()
'Was hoping the following code would transfer DASHNO back to my modmain
Dim DASHNO
If List1.Selected(0) Then DASHNO = "20"
If List1.Selected(1) Then DASHNO = "23"
If List1.Selected(2) Then DASHNO = "25"
If List1.Selected(3) Then DASHNO = "30"
If List1.Selected(4) Then DASHNO = "32"
CrtData "@Number " & List1 & " WAS SELECTED@"
Unload Me
End Sub

User avatar
US_Helpdesk
Moderator
Moderator
Posts: 1087
Joined: Wed Feb 23, 2011 7:26 pm

Re: Drop Down Box

Post by US_Helpdesk » Wed Jun 12, 2013 10:22 am

What exactly are you trying to do? Please specify your application for VB and we can try to help. The code you posted will not work with CMM-M's VB Scripting engine. It looks like maybe this is VBA code, maybe from Excel or Access?
I've migrated to a new user account, see my other posts here

Walleye Angler
Participant
Participant
Posts: 7
Joined: Tue Nov 27, 2012 11:04 am

Re: Drop Down Box

Post by Walleye Angler » Wed Jun 12, 2013 12:07 pm

I am using MeasureMax ControlCenter Version 2.01 from the late 1990's. When we create a program it generates these three files - Modmain.bas, Modsupport.bas, and Modstartup.bas. We typically write our code long hand in the modmain.bas.

Recently I learned how I could add a setup picture to a program by adding a form. Since then I have been experimenting to see what else I could do with forms. I successfully made a drop down list box by adding a form. The trouble I have is getting my modmain.bas program to read the data selected in my dropdown list therefore making it usable. My tests show that "DASHNO" is set while running the form but "DASHNO" is not reconized in the modmain.

Thanks for the help.

User avatar
US_Helpdesk
Moderator
Moderator
Posts: 1087
Joined: Wed Feb 23, 2011 7:26 pm

Re: Drop Down Box

Post by US_Helpdesk » Wed Jun 12, 2013 4:15 pm

This is a CMM-Manager Forum and provides no support or threads for MeasureMax. Try the CMM-Guys forum instead. This is a forum with discussions about all CMM software / hardware.
I've migrated to a new user account, see my other posts here

Walleye Angler
Participant
Participant
Posts: 7
Joined: Tue Nov 27, 2012 11:04 am

Re: Drop Down Box

Post by Walleye Angler » Thu Jun 13, 2013 7:35 am

Thanks for trying. I'm pretty much self taught on programming our cmm's and have learned a lot of cool tricks from the threads in this forum.

Post Reply