none
WinForm ListBox problem RRS feed

  • 問題

  • Hello,

    How can I add item into ListBox in the following case ?

    Role r = new Role("admin", "System Administrator");

    Role r1 = new Role("user", "User");

     

    How can I add thr "r" and "r1" into the ListBox with the label "User" and the Value is the "user" or the "Role" object ?

     

    Best regards,
    Eric

     

    2007年3月24日 上午 02:39

所有回覆

  • You must use DataTable, DataSet or object implemented IList or IListSource interface to ListBox.DataSource, and set ListBox.DisplayMember and ListBox.ValueMember for "display" and "value".

    2007年3月24日 上午 02:54
    版主
  • Can you please to give me a simple example to implement my previous post?

     

    Best regatds,

    Eric

     

    2007年4月2日 上午 03:43