I have a tab control with three tabs and I have added a datagridview to each of the first two tabs at design time. Programatically, when the second tab is selected, I am attempting to create columns and add them to the datagridview on the second tab. However, they show up in the datagridview on the first tab. I can't figure out what I'm doing wrong; if I step through the code I can see that the selected tab is the correct tab (the second one). Any suggestions?

Without seeing your code, i'd just be guessing that you are adding it to the wrong datagrid.

I agree.. Make sure you're focussed on the correct datagridview. If this is the case just do a simple test by removing the grid on tab 1 and tab 3 and check if it adds to the grid on tab 2. Crude but effective.

Well I feel like an idiot, you guys were correct; I had a typo that was causing things to add to the wrong grid. Thanks for the help.

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.