I have 2 forms. One is a typed list having 3 controls (fields) loaded from access database (copied to project as part of .xsd).
The values in this list represent recommended values of items and will also be applied to another 3rd form eventually. In the 2nd form there are 3 values which are populated (a) from dropdown lists, (b) with required input or (c) can be taken from form 1. Can anyone offer some help as to how to do option (c) without losing other two options? I hope this makes sense.

Recommended Answers

All 8 Replies

You can access the controls on Form1 from Form2 by fully qualifying them as (for example)

Form1.TextBox1.Text

If the valuies taken from form1 are to be default values that the user can change as needed, one option is to overload the Show method and send the values directly to the second form when the calling form calls the Show method.

Thanks tinstaafl,

What you are suggesting is what I am looking to do. I'm very new to this so will have to study 'overloading the Show method'. Maybe you have some suggestions? I am really appreciating this site.

In the second form add the overloaded method something like this:

Public Overloads Sub Show(input As String)
    TextBox1.Text = input
    Me.Show()
End Sub

Then in the calling form, call it something like this:

    Dim NewForm2 As New Form2
    NewForm2.Show(TextBox1.Text)

You can add whatever data you want as parameters.

Thanks for response. I think I probably need to return to basics and start over!
My first screen appears as a table taken from a typed dataset of common possible options and contains a combination of 2 fields which will never need editing or updating.
My second screen has 2 similar fields which are ComboBoxes and which I can select in any combination of offered figures or input non-standard selection.
If I choose to use one of the options from first screen then I need to select the row that I need and pass both field values to relevant field of second screen.
So far I can't even work out how to select the required row from screen one.

What control(s) are you using to display the table?

The table which contains the list of options (Form1) has 2 places where it can be opened from. One is a button control on a 'Main Menu' (Form3) or, alternatively, from a button control within Form2.

That doesn't say what control is displaying the data. Table contains the data doesn't display it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.