Results 1 to 8 of 8

Thread: Passing values between forms. [Resolved]

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    4

    Resolved Passing values between forms. [Resolved]

    I created a form that acts as a numeric entry keypad. This same keypad can be called up from multiple forms. I can pass the name of the calling form to the keypad as well as the name of the text box that I want to place the value that is acquired from the keypad. My question is: how can I use these known values of calling form and text box to place the keypad value into.

    i.e. "Calling Form"."Text Box".Text = KeypadValue.Text

    I can't seem to string together the name of the calling form and the text box without getting some kind of error. If I try to string them together before assigning the value of KeypadValue.Text, I still can't seem to do it.

    i.e. KeypadDummyVar.Text = CallingForm & "." & TextBox & ".Text"
    KeypadDummyVar.Text = KeypadValue.Text

    This merely re-assigns a value for KeypadDummyVar.Text

    I'm sure that there is a simple way to do this, but I seem to have hit a mental block on coming up with other options.

    I'm trying to avoid placing multiple if-then-else statements in my Keypad form
    code to figure out where the Keypad.text goes. (i.e. what form it goes to and what text box on that form should display the value.)
    ************************
    I'll try to clarify:

    On multiple forms, I am calling the Keypad form to enter values into the calling form. I've defined 2 textboxes on the keypad (hidden), to hold the name(s) of the calling form and the text Item on the calling form to which the keypad value will be plugged into. The code behind the control on the calling form looks something like this:

    Private Sub ChgUpperKO1Offset_Click()
    Keypad.CallingForm.Text = "SystemSpecs"
    Keypad.CallingText.Text = "UpperKO1Offset"
    Keypad.Show
    End Sub

    The Keypad value is stored in a text box called "NewValue". What I would like to do, is when the enter button on the keypad is pressed, plug NewValue directly in to the CallingText box on the CallingForm.

    i.e., for the example above, the code for the enter button on the keypad would be interpreted as follows:

    Private Sub EnterButton_Click()
    SystemSpecs.UpperKO1Offset.Text = EnterButton.Text
    End Sub

    But I don't know how to "string together" the destination values without the tedious programming such as this:

    Private Sub EnterButton_Click()
    If CallingForm.Text = "SystemSpecs" Then
    If CallingText.Text = "UpperKO1Offset" Then
    SystemSpecs.UpperKO1Offset.Text = EnterButton.Text
    Else If CallingText.Text = "UpperKO2Offset" Then
    .
    .
    .
    End If
    Else If CallingForm.Text = "SystemSettings" Then
    If CallingText.Text = "..............


    I think you get the jist. Did I mention I am a fairly novice VB programmer? (I bet you couldn't tell!)

    Thank you for the suggestions so far. I will continue to plug away.
    End Sub
    Last edited by mairhead; Mar 11th, 2005 at 08:38 AM. Reason: close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width