What is wrong with this code? It keeps throwing an "internal External Exception" and mentions line 11.



  • Someone mind telling me what's wrong with this code? Launguage is VB.net 2008 express edition
     
    <font color="#0000ff" size="2">Imports</font><font size="2"> System.Threading</font>
    <font color="#0000ff" size="2">
    </font>
    <font color="#0000ff" size="2">Imports</font><font size="2"> System.Uri</font>
    <font color="#0000ff" size="2">
    </font>
    <font color="#0000ff" size="2">Imports</font><font size="2"> System.IO</font>
    <font color="#0000ff" size="2">
    </font>
    <font color="#0000ff" size="2">Public</font><font size="2"> </font><font color="#0000ff" size="2">Class</font><font size="2"> Form1</font>

         <font color="#0000ff" size="2">Private</font><font size="2"> x </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font>
    <font size="2"> </font>
         <font color="#0000ff" size="2">Private</font><font size="2"> framerect </font><font color="#0000ff" size="2">As</font><font size="2"> Rectangle</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> destrect </font><font color="#0000ff" size="2">As</font><font size="2"> Rectangle = </font><font color="#0000ff" size="2">New</font><font size="2"> Rectangle(0, 0, 200, 200)</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> spritex </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2"> = 0</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> spritey </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2"> = 0</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> music </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">String</font><font size="2"> = Path.GetFullPath(</font><font color="#a31515" size="2">"Concerning_Hobbits.mp3"</font><font size="2">)</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> w </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2"> = picanim.Width</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> ht </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2"> = picanim.Height</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> done </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Boolean</font><font size="2"> = </font><font color="#0000ff" size="2">False</font>
    <font size="2"> </font>
         <font color="#0000ff" size="2">Private</font><font size="2"> canvas </font><font color="#0000ff" size="2">As</font><font size="2"> Graphics</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> scratchcanvas </font><font color="#0000ff" size="2">As</font><font size="2"> Graphics</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> scratchpic </font><font color="#0000ff" size="2">As</font><font size="2"> Bitmap</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> position </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Decimal</font><font size="2"> = 0</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> endtime </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Decimal</font>
    <font size="2"> </font>
         <font color="#0000ff" size="2">Private</font><font size="2"> sprite </font><font color="#0000ff" size="2">As</font><font size="2"> Bitmap = </font><font color="#0000ff" size="2">New</font><font size="2"> Bitmap(</font><font color="#a31515" size="2">"BilboAndGandalf.bmp"</font><font size="2">)</font>
         <font color="#0000ff" size="2">Private</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font><font size="2"> startbtn_Click(</font><font color="#0000ff" size="2">ByVal</font><font size="2"> sender </font><font color="#0000ff" size="2">As</font><font size="2"> System.Object, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> e </font><font color="#0000ff" size="2">As</font><font size="2"> System.EventArgs) </font><font color="#0000ff" size="2">Handles</font><font size="2"> startbtn.Click</font>
              <font size="2">w = picanim.Width</font>
              <font size="2">ht = picanim.Height</font>
              <font size="2">Thread.Sleep(1)</font>
              <font size="2">scratchpic = </font><font color="#0000ff" size="2">New</font><font size="2"> Bitmap(w, ht)</font>
              <font size="2">done = </font><font color="#0000ff" size="2">False</font>
    <font size="2"> </font>
              <font size="2">canvas = picanim.CreateGraphics</font>
              <font size="2">MP1.Ctlcontrols.play()</font>
              <font size="2">Thread.Sleep(1)</font>
              <font size="2">endtime = MP1.currentMedia.duration</font>
              <font size="2">Thread.Sleep(1)</font>
              <font size="2">musicprog.Value = position</font>
              <font size="2">musicprog.Maximum = endtime</font>
              <font size="2">scratchcanvas = Graphics.FromImage(scratchpic)</font>
              <font size="2">framerect = </font><font color="#0000ff" size="2">New</font><font size="2"> Rectangle(0, 0, w, ht)</font>
              <font color="#0000ff" size="2">Do</font>
    <font size="2"> </font>
                   <font size="2">scratchcanvas.DrawImage(sprite, destrect, framerect, GraphicsUnit.Pixel)</font>
                   <font size="2">position = MP1.Ctlcontrols.currentPosition</font>
                   <font size="2">framerect = </font><font color="#0000ff" size="2">New</font><font size="2"> Rectangle(spritex, spritey, w, ht)</font>
                   <font size="2">Thread.Sleep(1)</font>
                   <font size="2">musicprog.Value = position</font>
                   <font size="2">canvas.DrawImage(scratchpic, 0, 0)</font>
                   <font size="2">spritex = spritex + 200</font>
                   <font size="2">Thread.Sleep(1)</font>
                   <font color="#0000ff" size="2">If</font><font size="2"> spritex >= sprite.Width - w </font><font color="#0000ff" size="2">Then</font>
    <font size="2"> </font>
                        <font size="2">spritex = 0</font>
                   <font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">If</font>
    <font size="2"> </font>
                   <font size="2">Thread.Sleep(248)</font>
              <font color="#0000ff" size="2">Loop</font><font size="2"> </font><font color="#0000ff" size="2">Until</font><font size="2"> done = </font><font color="#0000ff" size="2">True</font>
    <font size="2"> </font>
              <font color="#0000ff" size="2">If</font><font size="2"> x = 1 </font><font color="#0000ff" size="2">Then</font>
    <font size="2"> </font>
                   <font size="2">Close()</font>
              <font color="#0000ff" size="2">Else</font>
    <font size="2"> </font>
              <font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">If</font>
    <font size="2"> </font>
         <font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font>
    <font size="2"> </font>
         <font color="#0000ff" size="2">Private</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font><font size="2"> resetbtn_Click(</font><font color="#0000ff" size="2">ByVal</font><font size="2"> sender </font><font color="#0000ff" size="2">As</font><font size="2"> System.Object, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> e </font><font color="#0000ff" size="2">As</font><font size="2"> System.EventArgs) </font><font color="#0000ff" size="2">Handles</font><font size="2"> resetbtn.Click</font>
         <font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font>
    <font size="2"> </font>
         <font color="#0000ff" size="2">Private</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font><font size="2"> closebtn_Click(</font><font color="#0000ff" size="2">ByVal</font><font size="2"> sender </font><font color="#0000ff" size="2">As</font><font size="2"> System.Object, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> e </font><font color="#0000ff" size="2">As</font><font size="2"> System.EventArgs) </font><font color="#0000ff" size="2">Handles</font><font size="2"> closebtn.Click</font>
         <font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font>
    <font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Class</font>

  • Discourse touched me in a no-no place

    Line 11:

    @Steeldragon said:

         <font color="#0000ff" size="2">Private</font><font size="2"> w </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2"> = picanim.Width</font>
    Not used vb.net, but a definition of picanim is conspicuously absent from the snippet posted.



  •  picaNIM IS A PICTURE BOX.

    nothing else needs explaining i think. sorry for caps.@PJH said:

    Line 11:

    @Steeldragon said:

         <font color="#0000ff" size="2">Private</font><font size="2"> w </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2"> = picanim.Width</font>
    Not used vb.net, but a definition of picanim is conspicuously absent from the snippet posted.




  • Internal [i]and[/i] External exception? Man, isn't your system b0rked.

    (If I were you, I'd paste more details about the exception.)



  • @Spectre said:

    Internal and External exception? Man, isn't your system b0rked.

    (If I were you, I'd paste more details about the exception.)

    I don't know much more. the assignment in our comp animation/programming class was to create an animation based on a movie that had music playing in the background. I do know though that it mentions some object being referenced and not declared.



  • It was the 11th line inside the button click subroutine.

    @Steeldragon said:

              <font size="2">musicprog.Value = position</font>

              <font size="2">musicprog.Maximum = endtime</font>
    I think i see it now. the values are on the wrong side of the equals sign.

Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.