?
Solved

Vb.Net to C# : Same event code for Multiple controls

Posted on 2006-03-24
2
Medium Priority
?
410 Views
Last Modified: 2008-03-10
Hi

Following Vb.net code handles ItemDrag events for
the ListView controls lvw1, lvw2, lvw3 and lvw4

Private Sub ListView_ItemDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles lvw1.ItemDrag, lvw2.ItemDrag, lvw3.ItemDrag, lvw4.ItemDrag
      sender.SelectedItems(0).Text = "Event Triggered"
End Sub

How to do the same in C# ?

Thanks
Shiju
0
Comment
Question by:Shiju Sasidharan
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 16286841
Try this:

      this.lvw1.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.ListView_ItemDrag);
      this.lvw2.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.ListView_ItemDrag);
      this.lvw3.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.ListView_ItemDrag);

private void ListView_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
{
     ((ListView)sender).SelectedItems(0).Text = "Event Triggered";
}

Bob
0
 
LVL 14

Author Comment

by:Shiju Sasidharan
ID: 16289000
Thank u Bob

That was fine :-)
Thank u

Shiju
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question