This has probably been asked a thousand times, but I can't seem to find how to do this,
Basically, I want to reference a BindingSource using a string based variable, but VB.NET won't let you cast from a string to a Binding Source.
Knowing how to do this would help me reduce a great deal of code.
For example, let's say that I have 10 different Binding Sources in my project. For simplicity sake, let's just say that they are named A_BindingSource, B__BindingSource, C_BindingSource, and so on up to j_BindingSource, Now for each one I want to be able to add a record, delete a record and save the record. I've gone ahead and put Tags on each button on the various forms to indicate the table name and it's function. There are other ways to do this, but that's what I'm using now. So if I write a Sub to use a Select Case, I would need one for each permutation. But if I could use a variable, it would be so much simpler. I'm imagining something like this:
Dim TagData() As String = sender.Tag.ToString.Split("|") ' Stored as Table | Function
Dim TableID As String = TagData(0) ' For example, "A_"
Dim BtnFunc As String = TagData(1) ' For example, "New"
Select Case BtnFunc
TableID & "BindingSource".AddNew()
TableID & "BindingSource".RemoveCurrent()
TableID & "BindingSource".EndEdit()
Me. & TableID & "TableAdapter.Update(Me.TheDataSet." & TableID & ")"
Obviously, the above code is very fictional, but I'm hoping that you get the "gist" of what I'm after.