Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
QuestionHow to convert .MPP File to .XML File in C# Pin
Rajesh_K_Sharma11-Aug-09 22:27
Rajesh_K_Sharma11-Aug-09 22:27 
AnswerRe: How to convert .MPP File to .XML File in C# Pin
Alenzo_Eid10-Mar-10 0:45
Alenzo_Eid10-Mar-10 0:45 
QuestionHow to Split one datatable to many datatables? Pin
NguyenDzung11-Aug-09 21:58
NguyenDzung11-Aug-09 21:58 
AnswerRe: How to Split one datatable to many datatables? Pin
dan!sh 11-Aug-09 22:14
professional dan!sh 11-Aug-09 22:14 
AnswerRe: How to Split one datatable to many datatables? PinPopular
Pete O'Hanlon11-Aug-09 22:36
mvePete O'Hanlon11-Aug-09 22:36 
GeneralRe: How to Split one datatable to many datatables? Pin
NguyenDzung12-Aug-09 17:40
NguyenDzung12-Aug-09 17:40 
GeneralRe: How to Split one datatable to many datatables? Pin
Prince Antony G5-Jan-12 22:32
Prince Antony G5-Jan-12 22:32 
QuestionGet what object a button belongs to? Pin
xkrja11-Aug-09 21:54
xkrja11-Aug-09 21:54 
I will try to shorten this question. If I have the following class:

public class MyClass
{
public int MyInt {get; set;}
public Button MyBtn {get; set;}
}


Now, let's say I have a for-loop that generates several objects of this class and hooks it up to an event handler like this:

for (int i = 0; i < 5; i++)
            {
                MyClass myClass = new MyClass();
                myClass.MyInt = i;
                myClass.MyBtn = new Button();
                myClass.MyBtn.Click += (s, e) =>
                {
                    //Is it possible to get the value of 'myClass.MyInt'
                    //in this event handler since 'myClass.MyBtn' belongs
                    //to the same object?
                };
            }


So, my question is: Is it possible to get the value of 'myClass.MyInt' when the button is clicked? I mean, 'myClass.MyBtn' and 'myClass.MyInt' belongs to the same object. The problem is that I must hook up all buttons to the same event handler.

Thanks for help!
AnswerRe: Get what object a button belongs to? Pin
Pete O'Hanlon11-Aug-09 21:58
mvePete O'Hanlon11-Aug-09 21:58 
GeneralRe: Get what object a button belongs to? Pin
xkrja11-Aug-09 22:09
xkrja11-Aug-09 22:09 
AnswerRe: Get what object a button belongs to? Pin
stancrm11-Aug-09 22:07
stancrm11-Aug-09 22:07 
GeneralRe: Get what object a button belongs to? Pin
xkrja11-Aug-09 22:19
xkrja11-Aug-09 22:19 
AnswerRe: Get what object a button belongs to? Pin
Luc Pattyn11-Aug-09 23:59
sitebuilderLuc Pattyn11-Aug-09 23:59 
AnswerRe: Get what object a button belongs to? Pin
Daniel Grunwald12-Aug-09 2:53
Daniel Grunwald12-Aug-09 2:53 
Questiontext box multiline Pin
Vivek Vijayan11-Aug-09 21:37
Vivek Vijayan11-Aug-09 21:37 
AnswerRe: text box multiline Pin
stancrm11-Aug-09 21:44
stancrm11-Aug-09 21:44 
AnswerRe: text box multiline Pin
Ashfield11-Aug-09 21:44
Ashfield11-Aug-09 21:44 
AnswerRe: text box multiline Pin
dan!sh 11-Aug-09 22:18
professional dan!sh 11-Aug-09 22:18 
QuestionException in access to textbox ? Pin
Mohammad Dayyan11-Aug-09 21:30
Mohammad Dayyan11-Aug-09 21:30 
AnswerRe: Exception in access to textbox ? Pin
stancrm11-Aug-09 21:40
stancrm11-Aug-09 21:40 
GeneralRe: Exception in access to textbox ? Pin
Mohammad Dayyan12-Aug-09 0:15
Mohammad Dayyan12-Aug-09 0:15 
AnswerRe: Exception in access to textbox ? Pin
Luc Pattyn12-Aug-09 0:01
sitebuilderLuc Pattyn12-Aug-09 0:01 
Questionthreading in a Custom Collection Pin
Juvil John11-Aug-09 21:29
Juvil John11-Aug-09 21:29 
AnswerRe: threading in a Custom Collection Pin
stancrm11-Aug-09 21:53
stancrm11-Aug-09 21:53 
GeneralRe: threading in a Custom Collection [modified] Pin
Juvil John11-Aug-09 22:51
Juvil John11-Aug-09 22:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.