Hi,
Thank for your advise. I had look at the FAQ, but
don't know how to get it to work, can you advise me
on my code below as I can't get it to work. I intend
to let my form1 call form2. On form2, when I click a command
button, it will display some text on form1. I want the flexiblity
to set which control on form1 to display.
Below is my code which is not working, please kindly advise me. Thank you
Form2 - which had a text box control, named : txtcheck and a command button
===========================================================================
Option Explicit
Public FormName As Form
Public FormDisplay As String
Private Sub cmdA_Click()
Set FormName = Forms.Add(FormDisplay)
Set FormName = Forms.Add("txtcheck") <===== I want to output to this control textbox
FormName.Text = "Okay"
End Sub
Form1 - which had a command button to activate form2
====================================================
Option Explicit
Private Sub cmdCallForm1_Click()
With Form2
.FormDisplay = "form1"
.Show vbModal
End With
End Sub
>See the "How to load a form using its name stored in a variable" in the FAQ (#756)
>
>
>>Hi,
>>
>>My application is a touchscreen application without any keyboard access.
>>My main screen had some option for user to enter data using my application
>>virtual keyboard.
>>
>>So, I though of creating a generic form that will be call by my main form
>>to show it and let user enter data which will appear on my main application.
>>Hence, I want my generic virtual keyboard form to be pass with the main form name and the controlname which the data will be display like e.g
>>
>>frmKeyboard.DisplayFormName = "frmMain"
>>frmKeyboard.DisplayFormControl = "txtAmount"
>>frmKeyBoard.Show vbModal
>>
>>How can I do this in VB6 ?
>>I want the virtual keyboard to be as generic as possible without hardcoding
>>the display form controlname like e.g
>>
>>VirtualKeyboard form code
>>=========================
>>Public FormName as Form
>>Public FormControlName as Control
>>
>>Private FrmDisplay as Form
>>
>>Set FrmDisplay = FormName <=== which is pass the main form name
>>
>>FrmDisplay.txtAmount.Text = "xxxx" <========= the controlname txtAmount is
>>hardcoded which I don't want as my main form had lot of control with different
>>name, I want to be able to set which control to display the data.
>>
>>
>>Please kindly help and advise me on this issue.
>>Thank you
Best Regards
Virusim