Results 1 to 2 of 2

Thread: throw an InvocationTargetException target exception

  1. #1
    ideiafix is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Aug 2010
    Posts
    1
    Reputation
    0

    Question throw an InvocationTargetException target exception

    Hi to everyone!

    This is my first post, and I really need you help.

    I have a visual Basic .net 2010 in fw4

    In developement environment works all perfect, but when I pass the app to client computer, gives the following error:

    throw an InvocationTargetException target exception

    And the code breaks here:

    Public FormsApps As New List(Of Form)

    FormsApps.Clear()

    For Each t As Type In Me.GetType().Assembly.GetTypes()
    If t.BaseType.Name = "Form" Then
    Application.DoEvents()
    FormsApps.Add(CType(Activator.CreateInstance(t), Form))
    Application.DoEvents()
    End If
    Next

    My ideia is to list all the forms existing in the application.

    Can you help me?

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,769
    Reputation
    1703
    What exactly are you trying to achieve? If we know that then I suspect that we could provide a better option for doing it.

    As for the exception, that means that a secondary thread threw an exception so you would have to check the stack trace for that original exception.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •