Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
QuestionPreventing user from changing dates and breaching software license Pin
Sunnt16-May-09 18:51
Sunnt16-May-09 18:51 
AnswerRe: Preventing user from changing dates and breaching software license Pin
mav.northwind16-May-09 19:37
mav.northwind16-May-09 19:37 
GeneralRe: Preventing user from changing dates and breaching software license Pin
OriginalGriff17-May-09 8:56
mveOriginalGriff17-May-09 8:56 
AnswerRe: Preventing user from changing dates and breaching software license Pin
Mycroft Holmes16-May-09 20:47
professionalMycroft Holmes16-May-09 20:47 
GeneralRe: Preventing user from changing dates and breaching software license Pin
PIEBALDconsult17-May-09 3:54
mvePIEBALDconsult17-May-09 3:54 
Questionhow to create even_click for dynamic button ? Pin
xingselex16-May-09 17:25
xingselex16-May-09 17:25 
AnswerRe: how to create even_click for dynamic button ? Pin
dybs16-May-09 18:27
dybs16-May-09 18:27 
AnswerRe: how to create even_click for dynamic button ? Pin
DaveyM6916-May-09 22:25
professionalDaveyM6916-May-09 22:25 
The actual method itself you will have to create beforehand, you cannot do this dynamically (it can be done by dynamcaly generating IL I believe but it's probably not neccesary).

You should create a general method that all your dynamic buttons call, you can retrieve the button from the sender parameter. To identify which button it is, you can use the Tag property (or use your own button class derived from Button and add some unique property to save some boxing/unboxing) if needed.
Button dynamicButton0 = new Button();
dynamicButton0.Click += new EventHandler(Button_Click);
dynamicButton0.Location = new Point(12, 12);
dynamicButton0.Tag = 0;
Controls.Add(dynamicButton0);

Button dynamicButton1 = new Button();
dynamicButton1.Click += new EventHandler(Button_Click);
dynamicButton1.Location = new Point(12, 34);
dynamicButton1.Tag = 1;
Controls.Add(dynamicButton1)
void Button_Click(object sender, EventArgs e)
{
    Button clickedButton = sender as Button;
    if (clickedButton.Tag is int)
    {
        int ID = (int)clickedButton.Tag;
        MessageBox.Show(ID.ToString());
    }
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

QuestionAn error witrh SQL Server and C# Pin
Mohammad Dayyan16-May-09 16:45
Mohammad Dayyan16-May-09 16:45 
AnswerRe: An error witrh SQL Server and C# Pin
Guffa16-May-09 16:54
Guffa16-May-09 16:54 
GeneralRe: An error witrh SQL Server and C# Pin
Mohammad Dayyan16-May-09 23:34
Mohammad Dayyan16-May-09 23:34 
GeneralRe: An error witrh SQL Server and C# Pin
Guffa22-May-09 13:20
Guffa22-May-09 13:20 
QuestionSentence Scanning Pin
beibay16-May-09 11:06
beibay16-May-09 11:06 
AnswerRe: Sentence Scanning Pin
Mycroft Holmes16-May-09 20:52
professionalMycroft Holmes16-May-09 20:52 
GeneralRe: Sentence Scanning Pin
beibay16-May-09 21:11
beibay16-May-09 21:11 
QuestionPlay Video stream coming from a network stream Pin
dihaz16-May-09 10:19
dihaz16-May-09 10:19 
QuestionDataset Update Pin
Stefano Negro16-May-09 10:03
Stefano Negro16-May-09 10:03 
QuestionMulti-threading using AutoResetEvent [modified] Pin
steve_rm16-May-09 9:28
steve_rm16-May-09 9:28 
AnswerRe: Multi-threading using AutoResetEvent Pin
S. Senthil Kumar16-May-09 9:39
S. Senthil Kumar16-May-09 9:39 
AnswerRe: Multi-threading using AutoResetEvent Pin
steve_rm16-May-09 17:24
steve_rm16-May-09 17:24 
GeneralRe: Multi-threading using AutoResetEvent Pin
Joe Woodbury16-May-09 18:21
professionalJoe Woodbury16-May-09 18:21 
GeneralRe: Multi-threading using AutoResetEvent Pin
steve_rm16-May-09 23:53
steve_rm16-May-09 23:53 
GeneralRe: Multi-threading using AutoResetEvent Pin
S. Senthil Kumar17-May-09 1:26
S. Senthil Kumar17-May-09 1:26 
GeneralRe: Multi-threading using AutoResetEvent Pin
Daniel Grunwald17-May-09 1:30
Daniel Grunwald17-May-09 1:30 
AnswerRe: Multi-threading using AutoResetEvent Pin
Luc Pattyn16-May-09 10:00
sitebuilderLuc Pattyn16-May-09 10:00 

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.