passing focus info form form to form 
Author Message
 passing focus info form form to form

I have an application where many forms call
1 "conversion" form.  On the "many" forms, when the user
is in any text box, once the user enters number data in
the box, the user can press a "convert" button that then
opens the "conversion" form and the data from the text
box is displayed and a number of unit conversions can be
selected.  Then the conversion form is closed and the new
converted answer is pasted back into the text box on the
form that called the conversion form.

I have this working with one starting form, and I have
the conversion form passing the data back by explictly
identifying the text box it came from.  But I want to
call this conversion form from many forms, so I have
tried pasing the name of the form that called the
conversion form, but I cannot seem to use this string in
the command to put the focus back to the orignal form and
text box.  Is there away of using a variable name
for "CallingForm" and textbox1" in a lines like:

' this is unloading conversion form and tring to get back
to the calling form...
Private Sub Form_Unload(Cancel As Integer)
'set focus to textbox that called
CallingForm.textBox1.SetFocus
'paste new value in textbox that called
CallingForm.textBox1 = NewValue
end sub

Thanks
Ted



Sat, 30 Jul 2005 14:45:16 GMT  
 passing focus info form form to form
You can pass the textbox itself as an argument:

Private mCallerTextBox as TextBox

Public DoConversion(txtbox as TextBox)
    set mCallertextBox = txtbox

:
:
Form_unload()
    mCallertextBox = "New Value"
    mCallertextBox .setfocus
    set mCallertextBox  = nothing


Quote:
> I have an application where many forms call
> 1 "conversion" form.  On the "many" forms, when the user
> is in any text box, once the user enters number data in
> the box, the user can press a "convert" button that then
> opens the "conversion" form and the data from the text
> box is displayed and a number of unit conversions can be
> selected.  Then the conversion form is closed and the new
> converted answer is pasted back into the text box on the
> form that called the conversion form.

> I have this working with one starting form, and I have
> the conversion form passing the data back by explictly
> identifying the text box it came from.  But I want to
> call this conversion form from many forms, so I have
> tried pasing the name of the form that called the
> conversion form, but I cannot seem to use this string in
> the command to put the focus back to the orignal form and
> text box.  Is there away of using a variable name
> for "CallingForm" and textbox1" in a lines like:

> ' this is unloading conversion form and tring to get back
> to the calling form...
> Private Sub Form_Unload(Cancel As Integer)
> 'set focus to textbox that called
> CallingForm.textBox1.SetFocus
> 'paste new value in textbox that called
> CallingForm.textBox1 = NewValue
> end sub

> Thanks
> Ted



Sat, 30 Jul 2005 18:28:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. passing forms and controls so I can set focus back to a form from a module

2. passing forms and controls so I can set focus back to a form from a module

3. Passing Info From Form to Form

4. Forms Collection: Using it to Open Forms by Passing the Form Name as a String Variable

5. MDI Form & Child Form Focus

6. Pass variable form module to a form

7. Passing values from Windows Form to Web Form

8. How do you pass from obj from one form to a module/forms

9. Pass form values to third party form?

10. Pass global variable from form to form

11. passing of information from form to form

12. Passing dynamic array of custom type to form method from another form

 

 
Powered by phpBB® Forum Software