Sychronize add columns in 2 datagridview controls

Hi Experts,

In Visual Studio 2005, I am creating a form/subforms to place orders to 4 different suppliers using their specific product numbers.

1. Form "POrders" with child Datagridview, "Datagridview1".
2. "Datagridview1" columns: "ColumnA", "ColumnB", "ColumnC", "ColumnD"
3. "ColumnA" is default column, others are hidden.
4. Never more than one column visable.

Form "POrders" command buttons:
1. Button "Products" opens "ProductsSub" Datagridview (List of Products to pass data to Datagridview1).
2. Buttons "ColumnA", "ColumnB", "ColumnC", "ColumnD" shows columns individually.
4. Again, Never more than one column visable

Form "ProductSub" command buttons:
1. Buttons "ColumnA", "ColumnB", "ColumnC", "ColumnD" shows columns individually.
4. Again, Never more than one column visable

I am trying to synchronize the buttons so they show the same column on both Datagridviews.
Or, have one set of buttons on the "POrders" form that show the same column on both Datagridviews.

I hope this makes sense.

Thanks for your help.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Well, You can access the forms from each other, so in the POrders ColumnA-button you could have code to manipulate the grids in the other forms.

Sub ColumnA_Click

Me.DatGridView1.Columns(0).Visible = True
Me.DatGridView1.Columns(1).Visible = False
Me.DatGridView1.Columns(2).Visible = False
Me.DatGridView1.Columns(3).Visible = False

ProductSub.DatGridView1.Columns(0).Visible = True
ProductSub.DatGridView1.Columns(1).Visible = False
ProductSub.DatGridView1.Columns(2).Visible = False
ProductSub.DatGridView1.Columns(3).Visible = False

End Sub

And to sync the data you should bind the grids to te same databindingsource object.

Hope I understood your question correctly.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dave_skyAuthor Commented:
It works great.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.