Results 1 to 14 of 14

Thread: [RESOLVED] VB 2017 Ex execution error & dll registration problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2021
    Posts
    8

    Resolved [RESOLVED] VB 2017 Ex execution error & dll registration problem

    I have a VB 2017 Express solution consisting of a main application project, and a setup project. I can do a build or publish without error if I specify "Any CPU". However, trying to run the exe generates the following error:

    Problem signature:
    Problem Event Name: CLR20r3
    Problem Signature 01: Synthesizer_ATE.exe
    Problem Signature 02: 1.0.0.0
    Problem Signature 03: 6079bf11
    Problem Signature 04: System.Windows.Forms
    Problem Signature 05: 4.8.4110.0
    Problem Signature 06: 5de6dad6
    Problem Signature 07: e12
    Problem Signature 08: 19
    Problem Signature 09: System.InvalidOperationException
    OS Version: 6.1.7601.2.1.0.256.48
    Locale ID: 1033
    Additional Information 1: 7505
    Additional Information 2: 7505f89cac61f322aed18b39a92bd34e
    Additional Information 3: a84f
    Additional Information 4: a84fa37088bdaaad2edf1ed2097cfeab



    I'm not the author of this app, but I'm supporting it now, so I'm responsible for modifying it, and distributing it. The original author states that I may need to specify x86 as the target. When I do that, I get several errors. Here's one of 7 almost identical errors:

    Severity Code Description Project File Line Suppression State
    Error BC30002 Type 'Microsoft.VisualBasic.PowerPacks.ShapeContainer' is not defined. Synthesizer_ATE C:\Users\bmoore\source\repos\Synthesizer_ATE_1_0_4\Synthesizer_ATE\Form1.Designer.vb 3264 Active

    There are six other errors related to PowerPacks. So I check to see if the dll is registered. I couldn't find any entry for it in the registry, so I attempted to register it. Then I get this error:

    Name:  PowerPacks_dll registration error.jpg
Views: 208
Size:  38.1 KB

    Ideas?

    Thanks.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    10,187

    Re: VB 2017 Ex execution error & dll registration problem

    I am personally not a big fan of the PowerPacks library. Generally speaking you are adding simple shapes to the project when using it. Are you open to refactoring the project so that you no longer need to include the DLL at all? If so, then I can help with that.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2021
    Posts
    8

    Re: VB 2017 Ex execution error & dll registration problem

    What is "refactoring the project"? I might be interested in doing that.

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    10,187

    Re: VB 2017 Ex execution error & dll registration problem

    Basically my suggestion would be to get rid of any instance of the PowerPacks library and replace them with their GDI+ counterpart. What I would need to know is what is currently being used now and how. In this instance screenshots may be incredibly helpful, usually they aren't but because the PowerPack components are controls (usually) created in the designer, I will need an idea of how they're being used.

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,095

    Re: VB 2017 Ex execution error & dll registration problem

    My view is the same as DDay. I tried out the PowerPacks in one project, and found it to be more hassle than it was worth. However, I was only using it for certain things, which as mostly to draw lines that responded to mouse events. The same functionality can be achieved using the GraphicsPath object, but the solution is very different, so converting from one to the other isn't necessarily automatic. Still, it would simplify the program and remove this issue, just not without some amount of effort.
    My usual boring signature: Nothing

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2021
    Posts
    8

    Re: VB 2017 Ex execution error & dll registration problem

    Here are the declarations:

    Code:
        Friend WithEvents ShapeContainer1 As Microsoft.VisualBasic.PowerPacks.ShapeContainer
        Friend WithEvents RectangleShape2 As Microsoft.VisualBasic.PowerPacks.RectangleShape
        Friend WithEvents RectangleShape1 As Microsoft.VisualBasic.PowerPacks.RectangleShape
    
            Me.ShapeContainer1 = New Microsoft.VisualBasic.PowerPacks.ShapeContainer()
            Me.RectangleShape2 = New Microsoft.VisualBasic.PowerPacks.RectangleShape()
            Me.RectangleShape1 = New Microsoft.VisualBasic.PowerPacks.RectangleShape()
    Here are all the lines of code using the above declarations:

    Code:
            Me.GroupBox4.Controls.Add(Me.ShapeContainer1)
    
    
            Me.ShapeContainer1.Location = New System.Drawing.Point(3, 16)
            Me.ShapeContainer1.Margin = New System.Windows.Forms.Padding(0)
            Me.ShapeContainer1.Name = "ShapeContainer1"
            Me.ShapeContainer1.Shapes.AddRange(New Microsoft.VisualBasic.PowerPacks.Shape() {Me.RectangleShape2, Me.RectangleShape1})
            Me.ShapeContainer1.Size = New System.Drawing.Size(272, 272)
            Me.ShapeContainer1.TabIndex = 52
            Me.ShapeContainer1.TabStop = False
            '
            'RectangleShape2
            '
            Me.RectangleShape2.Location = New System.Drawing.Point(63, 160)
            Me.RectangleShape2.Name = "RectangleShape2"
            Me.RectangleShape2.Size = New System.Drawing.Size(55, 1)
            '
            'RectangleShape1
            '
            Me.RectangleShape1.Location = New System.Drawing.Point(63, 130)
            Me.RectangleShape1.Name = "RectangleShape1"
            Me.RectangleShape1.Size = New System.Drawing.Size(55, 1)

    Is this enough info?
    Last edited by dday9; Apr 20th, 2021 at 10:01 AM.

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,095

    Re: VB 2017 Ex execution error & dll registration problem

    Shapes in PowerPacks can raise events. The next thing to look for is how RectangleShape1 and RectangleShape2 are used. Are events raised by these shapes handled?
    My usual boring signature: Nothing

  8. #8

    Thread Starter
    New Member
    Join Date
    Apr 2021
    Posts
    8

    Re: VB 2017 Ex execution error & dll registration problem

    To the code snippet above, I added the 3 lines after the "Friend WithEvents" lines. That's all the lines of code I can find with PowerPacks, ShapeContainer, or RectangleShape.

  9. #9
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    10,187

    Re: VB 2017 Ex execution error & dll registration problem

    You will need to generate the Paint event for your GroupBox. From here, add the following code:
    Code:
    Private Sub GroupBox4_Paint(sender As Object, e As PaintEventArgs) Handles GroupBox4.Paint
        Using linePen = New Pen(Color.Black, 1)
            Dim startingPoint = New Point(63, 130)
            Dim endingPoint = New Point(63 + 55, startingPoint.Y)
            e.Graphics.DrawLine(linePen, startingPoint, endingPoint)
    
            startingPoint.Y += 30
            endingPoint.Y = startingPoint.Y
            e.Graphics.DrawLine(linePen, startingPoint, endingPoint)
        End Using
    End Sub
    Since your code is essentially drawing lines and not rectangles I modified it to fit the intention.

    What my example does is:
    1. Declare a pen to use in order to draw using GDI+
    2. Declare a start/end point for the line
    3. Draw the first line
    4. Move the start/end point down 30 pixels
    5. Draw the second line

  10. #10

    Thread Starter
    New Member
    Join Date
    Apr 2021
    Posts
    8

    Re: VB 2017 Ex execution error & dll registration problem

    Quote Originally Posted by Shaggy Hiker View Post
    Shapes in PowerPacks can raise events. The next thing to look for is how RectangleShape1 and RectangleShape2 are used. Are events raised by these shapes handled?
    How do I find events raised by these elements?

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,095

    Re: VB 2017 Ex execution error & dll registration problem

    Quote Originally Posted by bemoore View Post
    How do I find events raised by these elements?
    There are a variety of ways, and slightly different options depending on the version of VS you are using. At the top of the code page there will be two or three drop down boxes. The one to the far left may have the form and controls on the form. You could select these controls, each in turn, at which point the drop down box to the right will have the events. If any event is handled, it will be bolded on that list.

    Another option would be to just search on Handles and AddHandler in the form code page (the .vb file NOT the .designer.vb file). You are unlikely to find AddHandler, whereas you are VERY likely to find Handles. In fact, you are very likely to find LOTS of Handles instances, as there will be one for every event handler not hooked up with AddHandler (of which there might well be none at all). Still, it would be easy enough to look through them to see if any handle events from those controls.
    My usual boring signature: Nothing

  12. #12

    Thread Starter
    New Member
    Join Date
    Apr 2021
    Posts
    8

    Re: VB 2017 Ex execution error & dll registration problem

    Quote Originally Posted by dday9 View Post
    You will need to generate the Paint event for your GroupBox. From here, add the following code:
    Code:
    Private Sub GroupBox4_Paint(sender As Object, e As PaintEventArgs) Handles GroupBox4.Paint
        Using linePen = New Pen(Color.Black, 1)
            Dim startingPoint = New Point(63, 130)
            Dim endingPoint = New Point(63 + 55, startingPoint.Y)
            e.Graphics.DrawLine(linePen, startingPoint, endingPoint)
    
            startingPoint.Y += 30
            endingPoint.Y = startingPoint.Y
            e.Graphics.DrawLine(linePen, startingPoint, endingPoint)
        End Using
    End Sub
    Since your code is essentially drawing lines and not rectangles I modified it to fit the intention.

    What my example does is:
    1. Declare a pen to use in order to draw using GDI+
    2. Declare a start/end point for the line
    3. Draw the first line
    4. Move the start/end point down 30 pixels
    5. Draw the second line
    Thanks, but... how do I call Group4_Paint? I don't understand the arguments "sender As Object, e As PaintEventArgs".

  13. #13
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    10,187

    Re: VB 2017 Ex execution error & dll registration problem

    This is an event handler that gets executed any time the control is redrawn. Here is the documentation on the event: https://docs.microsoft.com/en-us/dot....control.paint

    The sender parameter represents the control that invoked the event. The reason why this is important is because in Visual Basic .NET, you can handle multiple controls' events. So for example, let's say that you handled GroupBox1, GroupBox2, GroupBox3, and GroupBox4's paint event using the same event handler and you wanted to know which of the four controls actually invoked the event, you would use:
    Code:
    Private Sub GroupBoxes_Paint(sender As Object, e As PaintEventArgs) Handles GroupBox1.Paint, GroupBox2.Paint, GroupBox3.Paint, GroupBox4.Paint
        Dim invokingGroupBox = DirectCast(sender, GroupBox)
        Console.WriteLine(invokingGroupBox.Name)
    End Sub
    The e parameter represents the PaintEventArgs (documentation here). The PaintEventArgs holds the graphics of the control that invoked the event, this is what allows us to use the GDI+ methods (like DrawLine) for the control.

    To generate the event for the control, one option you have is to just copy/paste my code since I included the Handles clause for you. But if you wanted to generate it yourself, follow these steps:
    1. Open the designer view for your form (this is the view where you can drag/drop controls onto the form)
    2. Hit the F4 shortcut to bring up the Properties window
    3. From the dropdown at the top of the window, open it up and pick GroupBox4
    4. Just below the dropdown, click on the lightning bolt icon to bring up the events
    5. Scroll down the list and find the Paint event
    6. Double-click in the blank area to the right of the text "Paint"
    7. This will automatically generate the event with the handler for you


    Another option is to:
    1. Open the code view for your form (if you're in the designer view, right-click on the form and click View Code)
    2. At the top of the code view you will see three dropdowns
    3. In the middle dropdown, open it up and pick GroupBox4
    4. In the right dropdown, open it up and pick Paint
    5. This will automatically generate the event with the handler for you

  14. #14

    Thread Starter
    New Member
    Join Date
    Apr 2021
    Posts
    8

    Re: VB 2017 Ex execution error & dll registration problem

    This issue is resolved.

    Thanks for all the help.

Posting Permissions

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



Click Here to Expand Forum to Full Width