DropDownList doesn't have a Load method - so how does this code work?

Discussion in 'ASP .Net Web Controls' started by Novice, Apr 15, 2004.

  1. Novice

    Novice Guest

    Hi all, what is the equivalent of this C# in VB
    ----------------------------------------------
    DropDownList CustomerIdChooser
    CustomerIdChooser = new DropDownList()
    CustomerIdChooser.Load += new EventHandler(CustomerIdLoad)
    CustomerIdChooser.SelectedIndexChanged += new EventHandler(CustomerIdChanged)
    ----------------------------------------------
    I'm trying to build some webcontrols and initially I was just going to use the RenderControl method of the DropDownList to populate the DropDownList with each of the possible selections

    But then I came across the above C# code - is there a way to do something similar in VB.NET

    I tried doing this
    ----------------------------------------------
    CustomerIdChooser As DropDownLis
    CustomerIdChooser = new DropDownLis
    CustomerIdChooser.Load + new EventHandler(CustomerIdLoad
    ----------------------------------------------
    But the Load method doesn't appear to be a member of the DropDownList class. The reason I'm looking at this code is because I want to eventually populate this DropDownList with data from an XML file

    Thanks
    Novice
    Novice, Apr 15, 2004
    #1
    1. Advertising

  2. Novice

    Raterus Guest

    look at AddHandler to do this in VB

    AddHandler CustomerIdChooser.SelectedIndexChanged, AddressOf CustomerIdChanged

    Private Sub CustomerIdChanged(whatever the event args are..)
    'do stuff
    End Sub

    --Michael

    "Novice" <6tc1ATqlinkDOTqueensuDOTca> wrote in message news:D...
    > Hi all, what is the equivalent of this C# in VB:
    > -----------------------------------------------
    > DropDownList CustomerIdChooser;
    > CustomerIdChooser = new DropDownList();
    > CustomerIdChooser.Load += new EventHandler(CustomerIdLoad);
    > CustomerIdChooser.SelectedIndexChanged += new EventHandler(CustomerIdChanged);
    > -----------------------------------------------
    > I'm trying to build some webcontrols and initially I was just going to use the RenderControl method of the DropDownList to populate the DropDownList with each of the possible selections.
    >
    > But then I came across the above C# code - is there a way to do something similar in VB.NET?
    >
    > I tried doing this:
    > -----------------------------------------------
    > CustomerIdChooser As DropDownList
    > CustomerIdChooser = new DropDownList
    > CustomerIdChooser.Load + new EventHandler(CustomerIdLoad)
    > -----------------------------------------------
    > But the Load method doesn't appear to be a member of the DropDownList class. The reason I'm looking at this code is because I want to eventually populate this DropDownList with data from an XML file.
    >
    > Thanks,
    > Novice
    Raterus, Apr 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. underground
    Replies:
    5
    Views:
    4,191
    underground
    Jul 22, 2004
  2. Rudy Ko
    Replies:
    1
    Views:
    575
    Roger Helliwell
    Apr 28, 2005
  3. =?Utf-8?B?SmFzb24gQ2hhbg==?=

    DropDownList.SelectedIndex doesn't work after Databind

    =?Utf-8?B?SmFzb24gQ2hhbg==?=, Nov 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,827
    Eliyahu Goldin
    Nov 22, 2005
  4. Matthias Kaeppler
    Replies:
    22
    Views:
    927
    Thomas G. Marshall
    May 24, 2005
  5. fyleow
    Replies:
    4
    Views:
    333
    BartlebyScrivener
    Apr 20, 2006
Loading...

Share This Page