CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    [RESOLVED] Adding an Event at runtime C#

    Hi All,

    I have the following signature for a function:

    Code:
    protected void Option_SelectedIndexChanged(object sender, EventArgs e)
    	{.......}
    in another event Im creating a buttonlist control:

    Code:
    RadioButtonList myradiobuttonlist = new RadioButtonList();
            myradiobuttonlist.AutoPostBack = true;
            myradiobuttonlist.ID = "RoomOptionsRadioButtonList" + roomIndex.ToString();
    I need to bind myradiobuttonlist SelectedIndexChanged event to my method above, how do I do that please. I thought it might be the following, but the compiler doesn't like it.

    Code:
     myradiobuttonlist.SelectedIndexChanged += new Option_SelectedIndexChanged(myradiobuttonlist,new System.EventArgs);
    Although I think I need to Bind to the Option_SelectedIndexChanged event, it might be ok if it has it's own event and this event calls Option_SelectedIndexChanged.
    Last edited by Bill Crawley; February 24th, 2009 at 02:29 PM.
    If you find my answers helpful, dont forget to rate me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured