i need to call this function saveBase from more than one place
so i decided to send a number in variable x to know of what type to create the object named Model.
however when it's within the if statemet i keep getting the error that model is not declared !!!!!
how can i build the object i want of type depending on the incoming variable x ?????
thx
Public Function SaveBase(ByVal x As Integer) As BaseHumanModel
If x = 99 Then
Dim Model As New StudentModel
End If
If x = 99 Then
Dim Model As New UserModel
End If
Model.Code = TxtCode.Text
Model.Name = TxtName.Text
Model.Name2 = TxtName2.Text
Model.IDNumber = TxtID.Text
Model.Tel = TxtTel.Text
Model.Mobile = TxtMobile.Text
Model.BirthDate = DTPBdate.Text
'Model.BirthLocation.Code = CmbBaseHuman.SelectedValue
Model.Address = TxtAddress.Text
Model.Username = TxtUserName.Text
Model.Password = TxtPassword.Text
Return Model
End Function

New Topic/Question
Reply




MultiQuote





|