Referencing an object

ConnyD

Member
Joined
Oct 1, 2006
Messages
8
Programming Experience
1-3
I have a tabcontrol with a number of tab pages each of which contains a DataGridView control. I populate each DataGirdView form a local SQL Server. The method which does this works fine. The problem I'm having is I want to use the same method to populate each DataGridView control. I created a private member variable called mDataGridView as a DataGridView and use the TabControl SelectedTab property to determine which tab page the user has selected. I then try the following

If TabControl1.SelectedTab.Text = "TabPage1" Then
mDataGridView = dgvQuoteTemplate
End If

I then use mDataGridView in my method which retrieves data from the SQL database. Although the compiler dosn't gag at this it doesn't work. Am I right in thinking that mDataGridView references dgvQuoteTemplate?
 
Yes, it should reference the original DataGridView.

May I suggest to change your solution to pass a Datagridview a ByRef Parameter into the populate function?

Bobby
 
Thanks Bobby

The problem was with the TabPage selection code. I was using the .Text attribute when it shoulkd have been .Name dohhh
 
Back
Top