Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem With If Statement
#1
I am trying to simulate responding to a perimeter alarm by turning on lights in a sequence.  I am having problems getting the reponse to work.  Everything works fine until I add the third \'Do\' command line, it even works if I remove the \'After 7 Seconds Using Perimeter03\' from that line of code.

If NightTime <> 0 Then
    If AlarmState <> Idle Then
        Do 1stLandingOn After 3 Seconds Using Perimeter01
        Do HallLightOn After 5 Seconds Using Perimeter02
        Do KitchenSpotOn After 7 Seconds Using Perimeter03
    End If
End If

I have moved the \'Do\' lines around and each work in combinations of two, but as soon as I go to 3 \'Do\' commands I get the following error on execution of the response:
[img]file:///C:/Users/Podro/AppData/Local/Temp/moz-screenshot-1.png[/img]
\"The responses in this configuration may not have been written to comfort.  Do you want to do this before executing this response?\"

If I click yes I get the following exception code:

Unhandled exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Comfort.Form1.CommonDownload(List`1 rangeList)
   at Comfort.Form1.ExecuteResponse(Response response)
   at Comfort.Form1.ExecuteResponse_Click(Object sender, EventArgs e)
   at Comfort.Form1.propertyGridResponse_HyperLinkPropertyClicked(Object sender, PropertyHyperLinkClickedEventArgs e)
   at VisualHint.SmartPropertyGrid.PropertyGrid.OnHyperLinkPropertyClicked(PropertyHyperLinkClickedEventArgs e)
   at VisualHint.SmartPropertyGrid.PropertyHyperLink.OnPropertyClicked(PropertyEnumerator enumSelf, Point point, Rectangle itemRect)
   at ឆ.ᜀ(MouseEventArgs A_0)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at ឆ.ᜀ(Message& A_0)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

What am I doing wrong?
[img]file:///C:/Users/Podro/AppData/Local/Temp/moz-screenshot.png[/img]
Reply


Messages In This Thread
[No subject] - by - 04-16-2010, 10:15 PM
[No subject] - by - 04-17-2010, 02:03 AM
[No subject] - by - 04-17-2010, 08:19 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)