Im currently using this control to read tables from a database and allow the user to update them. Table values are loaded into this control based on the option selected in the Select Table menu. So if a user selects Table A from the the Menu, the values of Table A are loaded from the database.
However, Ive noticed that I cannot seem to display additional columns for other tables I dispaly. For example, in design mode I have set the DataMember property of this control to "Table A" So only the columns in this table will appear. (say 2 columns). But when I change it through my code to a different table (depending upon the option that the user has selected - Example Table B) only the first two rows of table B appear not the third one. But ive noticed that if i set this to a default in design mode and click on the "Retrieve Fields" property of the datagrid control, all three columns appear hasslefree. Is there a way to run this "retrieve fields" property dynamically through my code.
Heres my code:
Private Sub mnuSelectTable_Click(index As Integer)
' Structure to set data grid to selected table
Select Case index
dtgTable.DataMember = "tblA" 'has 2 columns, also this table is already set, in design mode, to appear as default
dtgTable.DataMember = "tblB" 'has 3 columns, but only the first two show up...
dtgTable.DataMember = "tblC"
I'll appreciate if somecan please help me with this. I cannot use otehr controls as I am fixing someone elses code so that would require restructing his code/application.