Padre_Corleone
asked on
Value of type 'String' cannot be converted to '1-dimensional array of String'
I want to pass string values from my listbox to a function which is located in another file, I get an error when i try to pass values in
AddUsersToRoles()
Please Advice:
Dim lstItem As ListItem
For Each SelectedItem In CType(SelectRoles.FindCont rol("Avail ableRoles" ), ListBox).Items
If lstItem .Selected = True Then
MyRole= lstItem .Value
System.Web.Security.Roles. AddUsersTo Roles(Crea teUserWiza rd1.UserNa me, MyRole)
End If
Next
Error: Value of type 'String' cannot be converted to '1-dimensional array of String'
this errors is in: AddUsersToRoles(CreateUser Wizard1.Us erName, MyRole)
AddUsersToRoles Object Browswer:
Public Shared Sub AddUsersToRoles(ByVal usernames() As String, ByVal roleNames() As String)
Member of: System.Web.Security.Roles
Summary:
Adds the specified users to the specified roles.
Parameters:
roleNames: A string array of role names to add the specified user names to.
usernames: A string array of user names to add to the specified roles.
Exceptions:
System.Configuration.Provi der.Provid erExceptio n: Role management is not enabled.
System.ArgumentNullExcepti on: One of the roles in roleNames is null.-or-One of the users in usernames is null.
System.ArgumentException: One of the roles in roleNames is an empty string or contains a comma (,).-or-One of the users in usernames is an empty string or contains a comma (,).-or-roleNames contains a duplicate element.-or-usernames contains a duplicate element.
AddUsersToRoles()
Please Advice:
Dim lstItem As ListItem
For Each SelectedItem In CType(SelectRoles.FindCont
If lstItem .Selected = True Then
MyRole= lstItem .Value
System.Web.Security.Roles.
End If
Next
Error: Value of type 'String' cannot be converted to '1-dimensional array of String'
this errors is in: AddUsersToRoles(CreateUser
AddUsersToRoles Object Browswer:
Public Shared Sub AddUsersToRoles(ByVal usernames() As String, ByVal roleNames() As String)
Member of: System.Web.Security.Roles
Summary:
Adds the specified users to the specified roles.
Parameters:
roleNames: A string array of role names to add the specified user names to.
usernames: A string array of user names to add to the specified roles.
Exceptions:
System.Configuration.Provi
System.ArgumentNullExcepti
System.ArgumentException: One of the roles in roleNames is an empty string or contains a comma (,).-or-One of the users in usernames is an empty string or contains a comma (,).-or-roleNames contains a duplicate element.-or-usernames contains a duplicate element.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.