HELP: Printing carriage return character

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Lemieux

    HELP: Printing carriage return character

    Using Visual Basic 6.0

    I want the program to be able to print the carriage return.

    txtDisplay.Text = "Welcome to" + Chr(13) + "my demo."

    All I get is

    Welcome to|my demo.

    With some strange character instead!



  • Stephane Richard

    #2
    Re: Printing carriage return character

    Hi Rob,

    you need to set the textbox's MultiLine property to true....you can do it at
    Design time and in run time.

    In run time:
    txtDisplay.Mult iLine = True

    --
    Stéphane Richard
    Senior Software and Technology Supervisor

    For all your hosting and related needs
    "Rob Lemieux" <lrlemieux@hotm ail.com> wrote in message
    news:%PFUa.511$ Fq2.187473@news 20.bellglobal.c om...[color=blue]
    > Using Visual Basic 6.0
    >
    > I want the program to be able to print the carriage return.
    >
    > txtDisplay.Text = "Welcome to" + Chr(13) + "my demo."
    >
    > All I get is
    >
    > Welcome to|my demo.
    >
    > With some strange character instead!
    >
    >
    >[/color]


    Comment

    • Bob Butler

      #3
      Re: Printing carriage return character

      "Stephane Richard" <stephane.richa rd@verizon.net> wrote in message
      news:wsGUa.5568 $cM6.2317@nwrdn y01.gnilink.net[color=blue]
      > Hi Rob,
      >
      > you need to set the textbox's MultiLine property to true....you can
      > do it at Design time and in run time.
      >
      > In run time:
      > txtDisplay.Mult iLine = True[/color]

      Did you try that? I get "can't assign to read-only property"
      It has to be set at design time


      Comment

      • Rob Lemieux

        #4
        Re: Printing carriage return character

        I got my solution from the sister group "com.lang.basic .visual":

        --------------------------------------------------------------------
        You need both a carriage return AND a linefeed and the textbox's Multiline
        property must be True

        txtDisplay.Text = "Welcome to" & Chr$(13) & Chr$(10) & "my demo."
        or
        txtDisplay.Text = "Welcome to" & vbCRLF & "my demo."
        or
        txtDisplay.Text = "Welcome to" & vbNewLine & "my demo."

        Note that Chr$ is slightly faster than Chr because Chr$ returns a string
        directly while Chr returns a string inside a Variant; also, the & operand
        is specifically meant for string concatenation and using + can lead to
        trouble if you aren't careful about the data types
        --------------------------------------------------------------------

        "Bob Butler" <tiredofit@nosp am.com> wrote in message
        news:oYGUa.2770 0$Ne.22545@fed1 read03...[color=blue]
        > "Stephane Richard" <stephane.richa rd@verizon.net> wrote in message
        > news:wsGUa.5568 $cM6.2317@nwrdn y01.gnilink.net[color=green]
        > > Hi Rob,
        > >
        > > you need to set the textbox's MultiLine property to true....you can
        > > do it at Design time and in run time.
        > >
        > > In run time:
        > > txtDisplay.Mult iLine = True[/color]
        >
        > Did you try that? I get "can't assign to read-only property"
        > It has to be set at design time
        >
        >[/color]


        Comment

        • J French

          #5
          Re: HELP: Printing carriage return character

          On Sat, 26 Jul 2003 21:23:29 -0400, "Rob Lemieux"
          <lrlemieux@hotm ail.com> wrote:
          [color=blue]
          >Using Visual Basic 6.0
          >
          >I want the program to be able to print the carriage return.
          >
          >txtDisplay.Tex t = "Welcome to" + Chr(13) + "my demo."[/color]
          Is txtDisplay a Textbox ?
          If so is it MultiLine ?

          [color=blue]
          >
          >All I get is
          >
          >Welcome to|my demo.
          >
          >With some strange character instead!
          >
          >
          >[/color]

          Comment

          Working...