Simple question: - Printing to Text Box 
Author Message
 Simple question: - Printing to Text Box

Please forgive me if this is obvious but I am new to VB

I am using VB4 and want to print out a selection of a recordset into a
scrolling text box so that they appear in a tabular format.

I have two problems, firstly making textbox.text = recordset.value only
shows the last record, it is overwriting all the other records. How do I
get a carriage return or move on to the next line

The second problem is how to open out the fields in the recordset when
they are printed in the text box so that they are in neat columns
Pat Farnaby



Sat, 30 Oct 1999 03:00:00 GMT  
 Simple question: - Printing to Text Box

Quote:

> [...]
> I have two problems, firstly making textbox.text = recordset.value only
> shows the last record, it is overwriting all the other records. How do I
> get a carriage return or move on to the next line

I think you have mistaken somehow (a typo?) because in my VB the
Recordset object does not have Value property. Instead, you should use
Fields collection and every Field object has the Value property
which is default so you don't have to type ".Value" explicite.

First of all, you should set MultiLine property of TextBox to True.
I doesn't seem that data bound text control would be good for you,
so you must do something like that:

Dim sTemp As String
While Not rst.EOF
        If sTemp <> "" Then sTemp = sTemp & vbCrLf          ' This to break the lines
        sTemp = sTemp & rst.Fields(0) & vbTab & rst.Fields(1)       ' or whatever to retrieve data
        rst.MoveNext
Wend
textbox.Text = sTemp

Hope that all data you want to display can fit in both sTemp string
variable and textbox.

Quote:
> The second problem is how to open out the fields in the recordset when
> they are printed in the text box so that they are in neat columns

vbTab (or some of them--look above) should help. Good luck.

RL



Sun, 31 Oct 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Printing a simple text box

2. Very simple and quick question regarding a text box in VB6

3. Two simple beginner questions: PrintForm and text box problem in VB5.0

4. Simple text box question

5. Quick simple question about text boxes

6. Simple Text Box Question

7. 2 simple questions (text boxes)

8. Simple Text Box question

9. Simple Text Box Questions from Newbie

10. Newbie Question - Moving from text box to text box (without tab)

11. Newbie question: Rich Text Box vs. Text Box

12. dear text box guru(s): fancy text box question...

 

 
Powered by phpBB® Forum Software