dcsimg
Results 1 to 3 of 3

Thread: Online translator error?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    416

    Online translator error?

    I am trying to follow the tutorial here https://docs.microsoft.com/en-us/asp...-forms-project.

    I am using vb.net in VS2017. I am getting a couple of errors here

    Name:  errors.jpg
Views: 166
Size:  30.8 KB

    Is this a C# to vb.net error (I have used an online translator)?

    Thanks!

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,788

    Re: Online translator error?

    Please don't post screenshots of code and if you want help with errors then it would help to provide the error message. Copy the relevant code as text, paste it into a post as text, wrap it in [code] tags and then highlight the relevant parts in bold or using colour. Then, copy the error message(s) as text and paste it into the post and wrap it in [quote] tags.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    416

    Re: Online translator error?

    Thanks jmcilhinney

    This is the code:

    Code:
    Imports Microsoft.AspNet.Identity
    Imports System
    Imports System.Linq
    
    Namespace WebFormsIdentity
    
        Public Class Register
            Inherits Page
    
            Public Property StatusMessage As Object
    
            Protected Sub CreateUser_Click(ByVal sender As Object, ByVal e As EventArgs)
                ' Default UserStore constructor uses the default connection string named: DefaultConnection
    
                Dim userStore = New UserStore(Of IdentityUser)
                Dim manager = New UserManager(Of IdentityUser)(userStore)
                Dim user = New IdentityUser
                Dim result As IdentityResult = manager.CreateAsync(user, Password.Text)
                If result.Succeeded Then
                    StatusMessage.Text = String.Format("User {0} was created successfully!", user.UserName)
                Else
                    StatusMessage.Text = result.Errors.FirstOrDefault
                End If
    
            End Sub
        End Class
    End Namespace
    The error that relates to IdentityUser:

    Class WebFormsIdentity.WebFormsIdentity.IdentityUser
    Type argument 'IdentityUser' does not inherit from or implement the constraint type 'IUser(OfString)'
    The error that relates to Password:
    Password is not declared

    Thanks again for your advice.

    Regards

    SteveHi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width