I Need Help With Text Boxes

Discussion in 'Software' started by chris6690, May 31, 2009.

  1. chris6690

    chris6690 Private E-2

    I am trying to create a text box to display all the data from a data base and I can't figure out how to get a line break inbetween each record. It just keeps puting them all together and dosen't go to the next line until there is no more room on the previouse line. What should I do?
     
  2. MutD

    MutD Specialist

    How are you displaying the records you are getting? On a web page, txt file, custom GUI?

    How are you getting the data from the database?
     
  3. chris6690

    chris6690 Private E-2

    I am usin VB6 I write directly to the text box from the file, I have a loop that writes each record and stops when there are no more records. I just need to know how to do a line break in a text box or get a scroll bar for a display box.
     
  4. MutD

    MutD Specialist

    put this inside your loop so it makes a new line each time:


    results.Append(vbNewLine)

    (where results is some Dim or some other variable you have declared elsewhere)
     
  5. chris6690

    chris6690 Private E-2

    I tyed that with the n I declared as a dim and it didn't work it tells me object required. what am I doing wrong? New code:

    Private Sub mnu_va_Click()
    Dim n
    'On Error GoTo errrun
    dba_PB.Recordset.MoveFirst

    Do Until txt_ID = ""

    txt_window.Text = txt_window.Text & " " & txt_lname.Text & " " & txt_fname.Text _
    & " " & txt_Adress.Text & " " & txt_apt.Text & " " & txt_city.Text & " " & txt_state.Text _
    & " " & txt_phone.Text
    ' vbNewLine
    n.Append (vbNewLine)



    dba_PB.Recordset.MoveNext
    Loop

    End Sub
     
  6. chris6690

    chris6690 Private E-2

    All you have to do is add & vbCrLf to the line of code. Thanks everyone...
     
  7. MutD

    MutD Specialist

    Sorry I should have been more clear. I meant if your whole results was a Dim.

    Try this:

    Private Sub mnu_va_Click()
    'On Error GoTo errrun
    dba_PB.Recordset.MoveFirst

    Do Until txt_ID = ""

    txt_window.Text = txt_window.Text & " " & txt_lname.Text & " " & txt_fname.Text _
    & " " & txt_Adress.Text & " " & txt_apt.Text & " " & txt_city.Text & " " & txt_state.Text _
    & " " & txt_phone.Text & vbNewLine




    dba_PB.Recordset.MoveNext
    Loop

    End Sub
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds