I want a quick way to be able to see all of the data that is currently in a DataTable. I want to be able to reference the name of the DataTable by entering string into a TextBox, have my program recognise that it's a DataTable that has data in it, and display that data in a 开发者_JAVA技巧DataGridView. Maybe this isn't the best approach but it's better than creating a Select Case scenario for each datatable I've created. Any ideas?
I think you should probably find a more robust way to do this. However, if you really do wish to use this model, you can associate a string to a DataTable using Dictionary<string, DataTable>
. Look up the entered string (making sure to handle cases in which the string is not found) among the dictionary keys, and you'll have your DataTable.
精彩评论