2

I'm just starting out with programming and in one of the courses it gets me to make a basic windows audio player. It had no functionality for skipping forward or backwards so I thought I'd add that to the basic program. I added the required buttons (button3 for rewind and button6 for fastforward) and set their clicked code-behind as follows:

    private void button3_Click(object sender, EventArgs e)
    {
        MyMediaPlayer.Ctlcontrols.currentPosition -= 5; 
    }

    private void button6_Click(object sender, EventArgs e)
    {
        MyMediaPlayer.Ctlcontrols.currentPosition += 5;
    }

The strange thing (to me anyway) is that the rewind works perfectly, whereas the fastforward doesn't work at all. A) what am I doing wrong and B) why the difference between the -= and the += in this case.

Thx.

Jeff

  • Use the debugger, set a breakpoint on the statement. Click the button and ensure that the debugger breaks. If it doesn't then you forgot to subscribe the Click event or got the name of the control mixed up. – Hans Passant Oct 23 '17 at 22:56
  • Thanks Hans. I kept the same code but changed the += to -= for button6 to see if it least did the same thing that button3 did. It didn't. Intellisense suggested I change it to a lambda expression but that didn't help either. I went into the properties for button6 and saw that the "clicked" event had nothing in it. I added "button6_Click" to the event and BINGO! We're in business! Thanks for your help . . . I'm sure I'll need more :) Jeff – Jeff Bowyer Oct 24 '17 at 01:43

0 Answers0