Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TextBox vs loop to print Beginner :) 2

Status
Not open for further replies.

benbizz

Programmer
Jan 8, 2005
4
CA
History:
if the checkbox is enable,
I would like toprint the caption of chexkbox
and print the text of textbox (Qty)

Name of my textbox is Text1,Text2,Text3,,....


checkbox is ok to print :

If Check(i).Value = 1 Then
Printer.Print Check(i).Caption
End If

***************************

but with the textbox ????
If Check(i).Value = 1 Then
Printer.Print Check(i).Caption & " " & Texti.Text
End If

errorObject required (Error 424)

error with Text(i).Text and I can't rename the name of textbox with Text(1)


???
 
You need to read up on control arrays....

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
The easiest way is to make your Textboxes into an array. Set the Index property of Text1 to 0, then change the other Textbox names to Text1 and change their Index values to 1,2,3 etc. You can then reference your textboxes in code via their index:

If Check(i).Value = 1 Then
Printer.Print Check(i).Caption & " " & Text1(i - 1).Text
End If

The [tt](i - 1)[/tt] value is because your index values start at 0 instead of 1.

See Control Array in VBHelp for more details

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

For tsunami relief donations

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Merci Beaucoup to mattKnight and johnwm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top