delegate in vb

Topics: Prism v4 - WPF 4
Jan 24, 2014 at 8:15 PM
Hi there,

I have been looking at wpf with prism as I need to expand my knowledge as I'm only doing window forms.

I have the stock trader demo in vb and I'm getting a error in the
OrdersController. StartOrder(ByVal tickerSymbol As String, ByVal transactionType As TransactionType)

The error is "The region does not contain the specified view."

AddHandler orderCompositeViewModel.CloseViewRequested, Sub()
                                                                   ordersRegion.Remove(orderCompositeViewModel) 'errors out on this line
                                                                   If ordersRegion.Views.Count() = 0 Then
                                                                   End If

                                                               End Sub

also I need to remove the handler.

Can someone help with this please.

Jan 31, 2014 at 2:38 PM

I have just download the VB version of the Stock Trader RI and could run the StockTraderRI_Desktop solution without any issues.
Have you made any modifications to the solution that could have generated this exception?

Basically, the exception you are recieving appears when you are trying to remove an element from a region but that element is not present in the region's collection.
This problem can appear when:
  • The element was removed from the region before this handler is executed.
  • The element was never injected in the region.
  • The element (in this case the OrderCompositeViewModel) implements the IRegionMemberLifetime interface. In this case, the view should be removed using the Deactivate method instead of the Remove method.
I hope this helps,

Damian Cherubini