Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass parameter to form constructor
Message
From
26/08/2007 10:06:07
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Pass parameter to form constructor
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01250488
Message ID:
01250488
Views:
55
Hi,
I have problem to pass parameter to form constructor using Activator.CreateInstance().

I have code below,

Hi,
I am facing the same problem.

I tried the code below.
            //Workign OK
            Payment.UI.Windows.Forms.PaymentForm loForm = new PaymentForm(new object[] 
                { JK.Payment.Enums.TxnType.Sale, salesBO.SaleNo, salesBO.Total });

            loForm.ShowDialog();

            loForm.Dispose();

            //Workign OK
            loForm = (PaymentForm)Activator.CreateInstance(Type.GetType("JK.Payment.UI.Windows.Forms.PaymentForm"));

            loForm.ShowDialog();

            loForm.Dispose();

            //NOT Workign OK
            loForm = (PaymentForm) Activator.CreateInstance(Type.GetType("JK.Payment.UI.Windows.Forms.PaymentForm"),
                                                            new object[]
                                                                {
                                                                    JK.Payment.Enums.TxnType.Sale, salesBO.SaleNo,
                                                                    salesBO.Total
                                                                });

            loForm.ShowDialog();
            loForm.Dispose();
Please advice

Thank you
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...
Next
Reply
Map
View

Click here to load this message in the networking platform