Some strange sql query. Why would you compare those two table, when you only want to get all the data from Studentinfo table. Admission table has nothing to do here, since you do get any data from Admission table.
So I recommend you to change the query to:
Mitja Bonca, how do you know that the Admission table has nothing to do with the students? Students get admitted, if a student is in the StudentInfo table but is not admitted and you only want the info for students that are admitted, this makes sense.
Yes it does. It really does. Sorry.
In this case, your approach is correct.
Even if StudentId field is only in Studentinfo table, it should work.
But if he has the same field name in more then one table, then it will not work.
As far as I can see he has the same name in Admission table too, so your code will do it!
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...