camerongtaylor
Structural
- Apr 22, 2008
- 1
Can anyone tell me whats wrong with my code?
First List box:
Rem Initialize List Box
ListBox.ResetContent()
Rem Add Strings here as needed
ListBox.AddString("Cast-in")
ListBox.AddString("Post-installed")
Rem Initialize Selection If desired
ListBox.CurSel = 0
Sub ListBoxEvent_Start()
End Sub
Sub ListBoxEvent_Exec(Inputs,Outputs)
sel = ListBox.CurSel
' Force sel to be a valid value, rather than -1
If sel < 0 Then
sel = 0
End If
' Highlight the selected value
ListBox.CurSel = sel
Outputs(0).Value = ListBox.GetText(sel)
If sel = 0 Then
Outputs(1).Value = 24
End If
If sel = 1 Then
Outputs(1).Value = 17
End If
End Sub
Sub ListBoxEvent_Stop()
Rem TODO: Add your code here
End Sub
Sub ListBox_SelChanged()
ListBox.Recalculate()
End Sub
Sub ListBox_DblClick()
ListBox.Recalculate()
End Sub
Second List Box:
Sub ListBoxEvent_Start()
sel = ListBox.CurSel
ListBox.ResetContent()
anchor = Worksheet.GetValue("AnchorSelection")
If anchor = "Cast-in" Then
ListBox.AddString "Cracked"
ListBox.AddString "Uncracked"
ElseIf mats = "Post-installed" Then
ListBox.AddString "Cracked"
ListBox.AddString "Uncracked"
End If
ListBox.CurSel = sel
End Sub
Sub ListBoxEvent_Exec(Inputs,Outputs)
sel = ListBox.CurSel
' Force sel to be a valid value, rather than -1
If sel < 0 Then
sel = 0
End If
' Highlight the selected value
ListBox.CurSel = sel
anchor = Inputs(0).Value
If sel >= 0 Then
Outputs(0).Value = ListBox.GetText(sel)
If anchor = "Cast-in" Then
If sel = 0 Then
Outputs(1).Value = 1.0
ElseIf sel = 1 Then
Outputs(1).Value = 1.25
End If
ElseIf anchor = "Post-installed" Then
If sel = 0 Then
Outputs(1).Value = 1.0
ElseIf sel = 1 Then
Outputs(1).Value = 1.4
End If
Else
Outputs(1).Value = 0
End If
Else
Outputs(0).Value = "No selection"
Outputs(1).Value = "N/A"
End If
End Sub
Sub ListBoxEvent_Stop()
Rem TODO: Add your code here
End Sub
Sub ListBox_SelChanged()
ListBox.Recalculate()
End Sub
Sub ListBox_DblClick()
ListBox.Recalculate()
End Sub
All im trying to do is get two different selections for one output in box 2, and the outputs from box two vary based on the selection in box 1. Any insight would help. Thanks.
Cameron
First List box:
Rem Initialize List Box
ListBox.ResetContent()
Rem Add Strings here as needed
ListBox.AddString("Cast-in")
ListBox.AddString("Post-installed")
Rem Initialize Selection If desired
ListBox.CurSel = 0
Sub ListBoxEvent_Start()
End Sub
Sub ListBoxEvent_Exec(Inputs,Outputs)
sel = ListBox.CurSel
' Force sel to be a valid value, rather than -1
If sel < 0 Then
sel = 0
End If
' Highlight the selected value
ListBox.CurSel = sel
Outputs(0).Value = ListBox.GetText(sel)
If sel = 0 Then
Outputs(1).Value = 24
End If
If sel = 1 Then
Outputs(1).Value = 17
End If
End Sub
Sub ListBoxEvent_Stop()
Rem TODO: Add your code here
End Sub
Sub ListBox_SelChanged()
ListBox.Recalculate()
End Sub
Sub ListBox_DblClick()
ListBox.Recalculate()
End Sub
Second List Box:
Sub ListBoxEvent_Start()
sel = ListBox.CurSel
ListBox.ResetContent()
anchor = Worksheet.GetValue("AnchorSelection")
If anchor = "Cast-in" Then
ListBox.AddString "Cracked"
ListBox.AddString "Uncracked"
ElseIf mats = "Post-installed" Then
ListBox.AddString "Cracked"
ListBox.AddString "Uncracked"
End If
ListBox.CurSel = sel
End Sub
Sub ListBoxEvent_Exec(Inputs,Outputs)
sel = ListBox.CurSel
' Force sel to be a valid value, rather than -1
If sel < 0 Then
sel = 0
End If
' Highlight the selected value
ListBox.CurSel = sel
anchor = Inputs(0).Value
If sel >= 0 Then
Outputs(0).Value = ListBox.GetText(sel)
If anchor = "Cast-in" Then
If sel = 0 Then
Outputs(1).Value = 1.0
ElseIf sel = 1 Then
Outputs(1).Value = 1.25
End If
ElseIf anchor = "Post-installed" Then
If sel = 0 Then
Outputs(1).Value = 1.0
ElseIf sel = 1 Then
Outputs(1).Value = 1.4
End If
Else
Outputs(1).Value = 0
End If
Else
Outputs(0).Value = "No selection"
Outputs(1).Value = "N/A"
End If
End Sub
Sub ListBoxEvent_Stop()
Rem TODO: Add your code here
End Sub
Sub ListBox_SelChanged()
ListBox.Recalculate()
End Sub
Sub ListBox_DblClick()
ListBox.Recalculate()
End Sub
All im trying to do is get two different selections for one output in box 2, and the outputs from box two vary based on the selection in box 1. Any insight would help. Thanks.
Cameron