You said if a user clicks button A, then show the date in TextBox A. If the user clicks button B, then show the date in TextBox B.
Then you go on to show that your event handler is not for a button click event but for the selection changed event of the calendar.
Like Bob said, if you want the behavior of what you originally asked, you can wire up both buttons to the same event handler and then examine the sender argument to determine which button is pressed.
On the other hand, if you want to figure out which button was pressed LAST before the calendar just changed its selection, then you need to keep track of which button was last pressed via a boolean instance variable. Alternatively, something like this lends itself to using radio buttons (mutually exclusive behavior) to choose which textbox to put the date in instead of push buttons.
-Brian
-----Original Message-----
From: Bob Grommes [mailto:[EMAIL PROTECTED]
Sent: Friday, November 12, 2004 12:51 PM
To: [EMAIL PROTECTED]
Subject: Re: [C#.NET] Re: Get the name of the clicked button
In this context my impulse would be to subclass the calendar control and add
a click handler that is wired up to both buttons.� But I've not tried
anything like this except with my own user controls.� If you don't have the
source to the calendar and the buttons of interest are not exposed as Friend
(or internal in C# parlance) then you would be out of luck, at least for
that approach.� Offhand I can't think of another angle -- and I'm sort of
swamped this morning.� Anyone else?
--Bob
----- Original Message -----
From: "Lude Gullit" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 12, 2004 10:32 AM
Subject: [C#.NET] Re: Get the name of the clicked button
>
>
> But I will assign the date to the textbox in the following sub which
> the sender name is calender not button. I want to know which button
> is clicked
>
> Private Sub cal1_SelectionChanged(ByVal sender As System.Object,
> ByVal e As System.EventArgs) Handles
> calDateRangeStart.SelectionChanged
>
> end sub
| Yahoo! Groups Sponsor |
| Get unlimited calls to U.S./Canada |
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/CSharpNET/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
