Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I recently created an application in vb.net and I have started recreating it in powershell. I have created the from layout and started working on the button actions and Im running into a road block, below is the sub I created in vb.net and I need to figure out how to create "e As Qios.DevSuite.Components.QCompositeEventArgs"

VB
Private Sub QCompositeControl2_ItemActivated(sender As Object, e As Qios.DevSuite.Components.QCompositeEventArgs) Handles qcItems.ItemActivated
           MsgBox(e.Item.ItemName.ToString)
    End Sub


How do I go about creating Event Arguments in powershell?
Posted
Comments
Sergey Alexandrovich Kryukov 14-Nov-13 23:50pm    
Why? I answered in detail, but why?
—SA

In your sample, nothing creates event arguments. Usually it is done in the class declaring some event, when you invoke the event (.NET allows to invoke events only in the classes declaring corresponding event instance nowhere else), but you can only create "real" .NET classes in PowerShell if you insert C# or VB.NET code, so I have no idea why would you need creation of event arguments in your PowerShell scrip. Okay, I'll give you the idea.

First of all, you will need to load this library (Qios or whatever). I don't know what is is, so I'll show you the sample loading System.Windows.Forms:
PHP
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

To hide console output, $null is used.

The partial name of your assembly registered in GAC should come instead of "System.Windows.Forms". If your library is just a file, you can load if with [System.Reflection.Assembly]::LoadFrom:
http://msdn.microsoft.com/en-us/library/1009fa28%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.reflection.assembly%28v=vs.110%29.aspx[^] (read on using this class).

To create an object from your assembly, such as Qios.DevSuite.Components.QCompositeEventArgs, you do something like:
PHP
$eventArgs = New-Object Qios.DevSuite.Components.QCompositeEventArgs
or, if you need to use constructor with arguments, you need to provide them:
PHP
$eventArgs = New-Object Qios.DevSuite.Components.QCompositeEventArgs($some, $reguired, $arguments)


As simple at that.

—SA
 
Share this answer
 
v2
VB
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim Browser As New WebBrowser
    BrowserTabControl.QTabpages.Add("New Tab")
    Browser.Name = "WebBrowser"
    Browser.Dock = DockStyle.Fill
    BrowserTabControl.Selectedtab.Controls.Add(Browser)
    int = int + 1

    Dim yo As New rtaGlassEffectsLib.rtaGlassEffect
    yo.TopBarSize = 31
    yo.ShowEffect(Me)
    yo.BottomBarSize = 0
    yo.LeftBarSize = 0
    yo.UseHandCursorOnTitle = False
    yo.ShowEffect(Me)

End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900