My really first question here. I come from an electrical engineering background and I have always use C to write program for microcontrollers so I am pretty new to VB net. Here my doubt :
I have different tab (TabControl1, ...2, ..3, etc) in a form and every tab page contains a datagridview (DataGridView1, .... ). and 1 button in common in the form.
How can I populate by pressing the button, the right datagridview base on the selectecTab?
I would do something like this:
selectedTab = TabControl1.SelectedIndex
if selectedTab = 0 then populate DataGridview1
else if selectedTab = 1 then populate DataGridview2
else if selectedTab = 2 then populate DataGridview3
....
But this code is limited because if in the future I need to add more Tab then I have to add more line of code.
Can you show me a smarter way to do it?
thanks a lot
- Nihilo