0

I have read over documents stating that for optimal Xbox One experience, I should disable Mouse Mode in my application. This makes absolute sense. all of the examples are in C# though, and m,y language of choice is unfortunately Visual Basic.

The C# code is:

public App() {
    this.InitializeComponent();
    this.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested;
    this.Suspending += OnSuspending;
}

I can translate the code to VB without an issue except for the last statement.

I seem to be stumped on the line: Me.Suspending += Me.OnSuspending

How might I translate this, and move forward with my development?

I'm at a road block and feel pretty dumb, because I should know how to do this.

EDIT: Even when changing the code to Me.Suspending = Me.Suspending + Me.OnSuspending the same raiseevent error is thrown. So therefor, this is NOT a duplicate, because I am well aware of how a += operator works.

  • VB.NET uses same `+=` operator for assignment too. It is equal to `Me.Suspending = Me.Suspending + Me.OnSuspending`. Read https://stackoverflow.com/questions/14693984/what-does-mean-in-visual-basic. – Tetsuya Yamamoto Oct 16 '17 at 05:00
  • Wow, I completely overlooked that! Thanks. – Mitchell_Dude Oct 16 '17 at 05:05
  • While it does still function the same, the modification of the code you suggested still throws an error as I described above. – Mitchell_Dude Oct 16 '17 at 05:07
  • 1
    You need `AddHandler` for example `AddHandler Me.Suspending, AddressOf OnSuspending`... Also make sure to remove the handler as well when you are done... – Trevor Oct 16 '17 at 05:31
  • 1
    Also this was kind of a dup, but not the one mentioned above. @Tetsuya Yamamoto has a trigger finger and `+=` is **not for handler assignment in vb.net**. The `+=` simply adds the value to an existing value of a variable. – Trevor Oct 16 '17 at 05:43

0 Answers0