new line

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hrvoje Voda

    new line

    name += function.Name + " ";

    How to write this code but with exception to put a function.Name into a new
    line ?



    I want to get a string name into a list like this:

    Function 1

    Function 2

    ....



    Hrcko




  • Nassos

    #2
    Re: new line

    Hi Hrvoje,
    try this
    name += function.Name + "\r\n";
    this will give a function name for every row
    Function 1
    Function 2
    if you want a line space between functions then
    name += function.Name + "\r\n\r\n";
    Hope that helps.


    "Hrvoje Voda" <hrvoje.voda@lu atech.com> wrote in message
    news:d8m42f$274 $1@ss405.t-com.hr...[color=blue]
    > name += function.Name + " ";
    >
    > How to write this code but with exception to put a function.Name into a
    > new line ?
    >
    >
    >
    > I want to get a string name into a list like this:
    >
    > Function 1
    >
    > Function 2
    >
    > ...
    >
    >
    >
    > Hrcko
    >
    >
    >
    >[/color]


    Comment

    • Michael Voss

      #3
      Re: new line

      Nassos wrote:[color=blue]
      > Hi Hrvoje,
      > try this
      > name += function.Name + "\r\n";[/color]

      Instead of "\r\n", you might want to use Environment.New Line:

      name += function.Name + Environment.New Line;

      [...snip...]


      Comment

      • Hrvoje Voda

        #4
        Re: new line

        I tried this. It doesn't work.


        "Nassos" <nasos@orama-tech.gr> wrote in message
        news:eW9KgTMcFH A.3204@TK2MSFTN GP12.phx.gbl...[color=blue]
        > Hi Hrvoje,
        > try this
        > name += function.Name + "\r\n";
        > this will give a function name for every row
        > Function 1
        > Function 2
        > if you want a line space between functions then
        > name += function.Name + "\r\n\r\n";
        > Hope that helps.
        >
        >
        > "Hrvoje Voda" <hrvoje.voda@lu atech.com> wrote in message
        > news:d8m42f$274 $1@ss405.t-com.hr...[color=green]
        >> name += function.Name + " ";
        >>
        >> How to write this code but with exception to put a function.Name into a
        >> new line ?
        >>
        >>
        >>
        >> I want to get a string name into a list like this:
        >>
        >> Function 1
        >>
        >> Function 2
        >>
        >> ...
        >>
        >>
        >>
        >> Hrcko
        >>
        >>
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Michael Voss

          #5
          Re: new line

          Hrvoje Voda wrote:
          [color=blue]
          > I tried this. It doesn't work.[/color]

          Works fine for me. Maybe you could try it the other way round:

          name += Environment.New Line + function.Name;

          [color=blue]
          > "Nassos" <nasos@orama-tech.gr> wrote in message
          > news:eW9KgTMcFH A.3204@TK2MSFTN GP12.phx.gbl...[color=green]
          > > Hi Hrvoje,
          > > try this
          > > name += function.Name + "\r\n";
          > > this will give a function name for every row
          > > Function 1
          > > Function 2
          > > if you want a line space between functions then
          > > name += function.Name + "\r\n\r\n";
          > > Hope that helps.
          > >
          > >
          > > "Hrvoje Voda" <hrvoje.voda@lu atech.com> wrote in message
          > > news:d8m42f$274 $1@ss405.t-com.hr...[color=darkred]
          > >> name += function.Name + " ";
          > >>
          > >> How to write this code but with exception to put a function.Name into a
          > >> new line ?
          > >>
          > >>
          > >>
          > >> I want to get a string name into a list like this:
          > >>
          > >> Function 1
          > >>
          > >> Function 2
          > >>
          > >> ...
          > >>
          > >>
          > >>
          > >> Hrcko
          > >>
          > >>
          > >>
          > >>[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Hrvoje Voda

            #6
            Re: new line


            It only works when I use a textbox control.
            IN comboBox and in listBox it's all in one line.


            "Nassos" <nasos@orama-tech.gr> wrote in message
            news:eW9KgTMcFH A.3204@TK2MSFTN GP12.phx.gbl...[color=blue]
            > Hi Hrvoje,
            > try this
            > name += function.Name + "\r\n";
            > this will give a function name for every row
            > Function 1
            > Function 2
            > if you want a line space between functions then
            > name += function.Name + "\r\n\r\n";
            > Hope that helps.
            >
            >
            > "Hrvoje Voda" <hrvoje.voda@lu atech.com> wrote in message
            > news:d8m42f$274 $1@ss405.t-com.hr...[color=green]
            >> name += function.Name + " ";
            >>
            >> How to write this code but with exception to put a function.Name into a
            >> new line ?
            >>
            >>
            >>
            >> I want to get a string name into a list like this:
            >>
            >> Function 1
            >>
            >> Function 2
            >>
            >> ...
            >>
            >>
            >>
            >> Hrcko
            >>
            >>
            >>
            >>[/color]
            >
            >[/color]


            Comment

            • Michael Voss

              #7
              Re: new line

              Hrvoje Voda wrote:[color=blue]
              >
              > It only works when I use a textbox control.
              > IN comboBox and in listBox it's all in one line.[/color]
              [...snip...]

              Sorry, I guess we misunderstood what you wanted. I undestood you asked about
              creating a string, obviously you wanted to insert rows into a listbox.

              So you will have to insert a new item into your box for each item you want
              to show like that:

              foreach(object item in myItems)
              {
              mylistbox.Items .Add(object.ToS tring)
              }


              Comment

              Working...