Can't find a type with this name

I’m trying to simplify my code and replace a bazillion occurrences of the same code with a global method. I get the error that’s the title of this thread on the two lines that reference ‘masterview’. What am I doing wrong?

Sub GoToView(masterview As iOSView)
If iOSSplitView.Available Then
  Dim split As New iOSSplitView
  Dim master As New masterview <---
  split.Master = master
  Dim detail As New FormView
  split.Detail = detail
  App.CurrentScreen.Content = split
Else
  Dim nosplit As New masterview <---
  App.CurrentScreen.Content = nosplit
End If
End Sub

You’re trying to create a new instance of a subclass with that New keyword.
If you want to use the instance of it that you passed to the method, you only need to reference the name.

So, split.Master = master becomes split.Master = masterview

Thanks, Tim!

So this doesn’t generate any errors:

Sub GoToView(masterview As iOSView) If iOSSplitView.Available Then Dim split As New iOSSplitView split.Master = masterview Dim detail As New FormView split.Detail = detail App.CurrentScreen.Content = split Else App.CurrentScreen.Content = masterview End If End Sub [/quote]

Using “GoToView(ChoicesView)” generates an error

“Dim view As New ChoicesView
GoToView(view)”

works but is there a cleaner way to use this?

You might be able to figure out what kind of view is being sent in to GoToView, but that just seems like it’s probably unnecessary for what you want to do. You can condense your call a little, but if you don’t dim it into a variable you won’t be able to use it elsewhere in the originating method.

GoToView(new ChoicesView)

This is all without looking at your project, so YMMV.