After log-in, it opens the MainForm.vb which IsMDIContainer property is set to true.
From the MainMenu, it opens a child form called Assure_Benefits.vb
So far no problem up to this point.
When Assure_Benefits.vb loads, it displays 2 DataGridViews with datasourses from my 2 tables in my database.
There is still no problem with the loading.
Now, to show the difference between different user types, I only allow the admin to edit the DataGrid. SO I set the readonly property to true when UserType = "user".
I have no problem doing that.
My problem is I want to add some codes besides the readonly being set to true and false but other codes are not executed and the program does not display any errors at all. i tried to add messageboxes on the if and else conditions to try if added codes will work but even the messagebox does not appear though the codes next to it are properly executed.
When my Assure_Benefits.vb loads I call for the subroutine below.
Private Sub SetControlProperties() If LogIn.UserType = "admin" Then MessageBox.Show("Yes") 'This line is not executed grid_LivingBenefits.ReadOnly = False 'Works perfectly fine grid_DeathBenefits.ReadOnly = False 'Works perfectly fine ElseIf LogIn.UserType = "user" Then MessageBox.Show("No") 'This line is not executed grid_LivingBenefits.ReadOnly = True 'Works perfectly fine grid_DeathBenefits.ReadOnly = True 'Works perfectly fine End If End Sub
I can't seem to understand why the first code is not executed when the next codes works fine.
This post has been edited by modi123_1: 10 February 2011 - 01:29 PM
Reason for edit:: please use code tags