Discussion Locked

Printing text from individual text boxes

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi all

I am trying to print text from individual text boxes on a form. The form has 18 individual text boxes on it, each text box displays a letter and number.

I would like to be able to print the text from the first 5 text boxes when there is text in them, and the last 13 text boxes when there is text in them

Could someone help me with this problem, by maybe writing a couple of code to get me started?

Thank you
Mark

3 replies

by cmiller5400

Ok, I have not done much in VB 6 but in VB.Net there is a collection object that you could use here is some code that comes to mind for VB.Net. Should be fairly easy to convert to VB6

Dim colTextBoxes As New Collection()

colTextBoxes.Add(TextBox1)
colTextBoxes.Add(TextBox2)
colTextBoxes.Add(TextBox3)
colTextBoxes.Add(TextBox4)

Dim tmp As Object

For Each tmp In colTextBoxes
If DirectCast(tmp, TextBox).Text <> "" Then
MsgBox(DirectCast(tmp, TextBox).Text)
End If
Next

This discussion is closed to new replies.