R
ronnel.santiago
hi guys,
i just have a doubt about this one... i have several class that just
basically do CRUD operations (create, read, update, delete) now for example
on my delete function, i want to create objects dynamically based on
TableName..
this is my current line of code
Public Sub ActionButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Select Case TableName.ToLower
Case "employee"
Dim o As New BusinessLogic.EmployeeController
o.Delete(1)
Case "gender"
Dim o As New BusinessLogic.GenderController
o.Delete(1)
Case "more of this on my code"
Dim o As New BusinessLogic.[other]Controller
o.Delete(1)
End Select
End Sub
now i want to make this line of code shorter, maybe by doing this
Public Sub ActionButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim o As New BusinessLogic.[TableName]Controller
o.Delete(1)
End Select
End Sub
note the [TableName] here is a property i created, so passing a EMPLOYEE as
the TableName will
Dim o As New BusinessLogic.EmployeeController and then i can call the delete
function, just want to load object dynamically here.. i hope i made my point
here clear...
is it anyway possible?
TIA!
(if i have 8 hours to chop down a tree, i'd spend 6 sharpening my ax)
i just have a doubt about this one... i have several class that just
basically do CRUD operations (create, read, update, delete) now for example
on my delete function, i want to create objects dynamically based on
TableName..
this is my current line of code
Public Sub ActionButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Select Case TableName.ToLower
Case "employee"
Dim o As New BusinessLogic.EmployeeController
o.Delete(1)
Case "gender"
Dim o As New BusinessLogic.GenderController
o.Delete(1)
Case "more of this on my code"
Dim o As New BusinessLogic.[other]Controller
o.Delete(1)
End Select
End Sub
now i want to make this line of code shorter, maybe by doing this
Public Sub ActionButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim o As New BusinessLogic.[TableName]Controller
o.Delete(1)
End Select
End Sub
note the [TableName] here is a property i created, so passing a EMPLOYEE as
the TableName will
Dim o As New BusinessLogic.EmployeeController and then i can call the delete
function, just want to load object dynamically here.. i hope i made my point
here clear...
is it anyway possible?
TIA!
(if i have 8 hours to chop down a tree, i'd spend 6 sharpening my ax)