Hello,
I am trying to set the default user’s authorizations so that it is an operator level. My customer wants the controller to boot with operator level access instead of with full access which the default user comes as. The following code, almost identical to the User Guide, will work as long as the default user has full access authorizations. If the default user does not have full access I get a “Object refernce not set to an instance of an object” error. The error occures at the
Me.controller = ControllerFactory.CreateFrom(controllerInfo)
line. So I don’t even have the chance to set the user and stuff. Robot Studio Online handles this setup fine so I would think I should be able to do it also.
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
Dim item As ListViewItem = Me.ListView1.SelectedItems(0)
Dim stName As String
Dim stPassword As String
If Not item.Tag Is Nothing Then
Dim controllerInfo As ControllerInfo
controllerInfo = DirectCast(item.Tag, ControllerInfo)
If controllerInfo.Availability = Availability.Available Then
If Not Me.controller Is Nothing Then
Me.controller.Logoff()
Me.controller.Dispose()
Me.controller = Nothing
End If
Try
Me.controller = ControllerFactory.CreateFrom(controllerInfo)
If MessageBox.Show(“Default user?”, “Login as”, MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.controller.Logon(UserInfo.DefaultUser)
Else
stName = InputBox(“Name”, “Login”)
stPassword = InputBox(“Password”, “Login”)
Dim AUserInfo As UserInfo = New UserInfo(stName, stPassword)
Me.controller.Logon(AUserInfo)
End If
Catch ex As Exception
MsgBox(ex.InnerException.Message)
End Try
End If
Else
MessageBox.Show(“Selected controller not available.”)
End If
End Sub
End Class
I am using RAB v5.09, Windows XP Sp2.
Thank You,
Ted