Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Tab Control: Activate Data Binding on Tab Child controls without having to view the tab
 

Tab Control: Activate Data Binding on Tab Child controls without having to view the tab

Greetings,

I have a form with a tab control. Tab1 has a "go" button tied to a class which retrieves values from databound comboboxes on tab2. I get an exception thrown if I hit "go" on tab1 without viewing tab2 first. How do I workaround this without having to show tab2 but make it's databound controls "active"
ZionGates  Monday, October 05, 2009 7:03 PM

Hi ZionGates,

Based on my understanding, we can call the Show method of the second TabPage to force it to be initialized.

I also suggest modifying the logic to avoid getting values from controls on tabpage2. For example, we can create a BindingSource programmatically and initialize it on the Load event handler of the Form. Then we can bind that BindingSource to the ComboBox on tabpage2. Now we can directly retrieve value via The Current property of the BindingSource.

Regards,
Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, October 07, 2009 9:56 AM

You can use google to search for other answers

Custom Search

More Threads

• ListChanged Event is raised when not Binding to Text property of TextBox
• Password field in DataGridView displaying actual password, not masked
• Threads-Bindings and Datasets Oh my
• DataGridView - How do I STOP sorting it?
• datagridview design!
• multiselect listbox producing duplicate index error
• Change of Columntypes after Rowfilter Bug.
• Changing ReadOnly of DataGridColumnStyle on the fly?
• how to enable Sorting in Gridview for which datasource is ArraryList
• SLOW response from datagridview when setting a cell value.