-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: ChellaBala
Message 1 in Discussion
Hi,
I have 5 buttons in a form which is going to do the same operation on click.
Only the parameter is going to be changed. For eg., Private sub
Button_Click(byval sender as object, byval e as system.eventargs) handles
button1_click, button2_click, button3_click, button4_click, button5_click
Dim seq as string 'I would like to use the select case based on the sender
SELECT Case sender CASE button1
seq = "1"
CASE button2
seq = "2"
CASE button3
seq = "3"
CASE button4
seq = "4"
CASE button5
seq = "5" END SELECT gfExecuteButtonClick(seq) End Sub
When I execute this, I received the following error: An unhandled exception
of type 'System.InvalidCastException' occured in Microsoft.VisualBasic.dll
Additional Information: Operator is not valid for type 'Button' and type
'Button' I don't want to rely on the text property of the button as
follows: (since it varies at run time) for eg., SELECT CASE Ctype(sender,
button).text
CASE "button1"
.... As there is no Name or Tag property available in .Net Compact
Framework, I don't know how I can do something like the above style... Can
anyone help me to do? Regards,
Chella
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]