Results 1 to 4 of 4

Thread: [RESOLVED] How to add & and vbCrLf in the textbox

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] How to add & and vbCrLf in the textbox

    I have listbox, see the attach files, I want to show in the textbox like this.. when I click at the command button.

    [Code] & vbCrLf & [N] & vbCrLf & [name]
    Attached Images Attached Images  

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: How to add & and vbCrLf in the textbox

    You need a simple loop. E. g.:
    Code:
    Dim n As Long
    
    For n = 0 To List1.ListCount - 1
      Text1.Text = Text1.Text & List1.List(n)
      
      If n <> List1.ListCount - 1 Then Text1.Text = Text1.Text & vbCrLf
    Next n

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: How to add & and vbCrLf in the textbox

    I don't want to add new line.. I just want in one line. For your infor I want to show the text vbCrlf in the my textbox.. Not add new line. I can' do that

    If n <> ListBox2.ListCount - 1 Then TextBox7.Text = TextBox7.Text & " vbCrLf"

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How to add & and vbCrLf in the textbox

    follow the same code what gavio gave in

    http://www.vbforums.com/showpost.php...06&postcount=7

    and replace

    If n <> List1.ListCount - 1 Then Text1.Text = Text1.Text & ", "

    with

    If n <> List1.ListCount - 1 Then Text1.Text = Text1.Text & " & vbCrLf & "
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width