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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rather unique printing problem. 1

Status
Not open for further replies.

kiwiCoder

Technical User
Aug 2, 2001
45
NZ
I was hoping someone can help me with a rather unique problem. I would like to use a variable names as control names to print value of variable. To clarify I have a form with multiple controls that is used as a template to print a label(form). As there are multiple label confiurations each labels controls collection properties are stored in a data base. if the user selects a particular label the form is loaded with a dynamic control array, each controls name and position coming from the database. As the controls name is the same as a local variable I was hoping the variable would be disp[alyed as the caption of each control but this doesn't work.. Any idea's greatfully appreciated.
 
you could declare the variables as public variable sin a module, and then use a for each control loop to iterate through your controls. If the control is a label, textbox, frame etc, then use the callbyname function to assign the control called text1 with .text=callbyname(me,ctrl.name,vbget).

Inside your for each control loop, you will need to place a select case statement to decide which type of control you are dealing with, as textboxes have .text and labels have .captions.

Ask if you need code examples.

BB

 
Not too sure if I explained my problem correctly or clearly, sorry, or quite possibly I didn't read your answer very well. By the way, thanks for the prompt response :). The form object(frmLabelTemplate) has a control array of label controls. The user can set up a "label template" by adding label controls and assigning its caption to a known variable, dragging the control to the appropriate position on the form then saving the "Template" to a db. The control array starts with a label named label1(0), this is not used but allows programming the mousedown event for all future labels so the position can be changed. An example control caption is mvPrintLabelArray(1,i). SO printer.print Label1(0).caption should print the value of mvPrintLabelArray(1,i), unfortunately after it is returned from trhe db it just prints the textual caption.

I have a small 62k sample app if you have a little time to look at it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top