Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Display List items?

Display List items?

Scheduled Pinned Locked Moved C#
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spankyleo123
    wrote on last edited by
    #1

    Hello All , Is there a way to display list (containing strings) items in a message box?

    List test = new List();

    test.add("one");
    test.add("two");
    test.add("three");

    And then displaying all the list items together in a single message box? Like MessageBox.Show(test); // ?? Thanks,

    H L L 3 Replies Last reply
    0
    • S spankyleo123

      Hello All , Is there a way to display list (containing strings) items in a message box?

      List test = new List();

      test.add("one");
      test.add("two");
      test.add("three");

      And then displaying all the list items together in a single message box? Like MessageBox.Show(test); // ?? Thanks,

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      Not as far as I am aware. However, a Messagebox is nothing much more than a Dialog. Design your own.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      1 Reply Last reply
      0
      • S spankyleo123

        Hello All , Is there a way to display list (containing strings) items in a message box?

        List test = new List();

        test.add("one");
        test.add("two");
        test.add("three");

        And then displaying all the list items together in a single message box? Like MessageBox.Show(test); // ?? Thanks,

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Following is basic example to do so.

        MessageBox.Show(string.Concat(test.ToArray()));

        You can explore more to fulfill your requirement or to customize it at whatever level you need. Hope this will help!

        Jinal Desai - LIVE Experience is mother of sage....

        1 Reply Last reply
        0
        • S spankyleo123

          Hello All , Is there a way to display list (containing strings) items in a message box?

          List test = new List();

          test.add("one");
          test.add("two");
          test.add("three");

          And then displaying all the list items together in a single message box? Like MessageBox.Show(test); // ?? Thanks,

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          try

          MessageBox.Show(string.Join(Environment.NewLine,test.ToArray()));

          :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          Prolific encyclopedia fixture proof-reader browser patron addict?
          We all depend on the beast below.


          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups