pinkladyxo 0 Newbie Poster

I need to assign code to a button, that when clicked on, validates an ISBN code, and displays a message that it is either Valid or Invalid. I basically need help transforming code used in a console application that will now be used in a windows form application, so no more writeline stuff, now message boxes.
Here is the code I need help with:

Select Case ISBN.Length
                Case 10
                    Dim x As Integer = 0
                    noCheck = ISBN.Substring(0, ISBN.Length - 1)
                    x = checkISBN10(ISBN, noCheck)
                    If x = 11 Then
                        noCheck += "0"
                    ElseIf x = 10 Then
                        noCheck += "X"
                    Else
                        noCheck += x.ToString
                    End If
                    If (ISBN <> noCheck) Then
                        System.Console.WriteLine("Invalid ISBN - Check digit is " & x)
                    End If
                Case Else
                    System.Console.WriteLine("Invalid ISBN length")
            End Select

Private Function checkISBN10( _
ByVal ISBN As String, ByVal noCheck As String) As Integer
        Dim x As Integer = 0
        If ISBN.Length = 10 Then
            x = 10 * Integer.Parse(noCheck.Chars(0))
            x += 9 * Integer.Parse(noCheck.Chars(1))
            x += 8 * Integer.Parse(noCheck.Chars(2))
            x += 7 * Integer.Parse(noCheck.Chars(3))
            x += 6 * Integer.Parse(noCheck.Chars(4))
            x += 5 * Integer.Parse(noCheck.Chars(5))
            x += 4 * Integer.Parse(noCheck.Chars(6))
            x += 3 * Integer.Parse(noCheck.Chars(7))
            x += 2 * Integer.Parse(noCheck.Chars(8))
            x = 11 - (x Mod 11)
        End If
        Return x
    End Function

Also, how do I make a connection between a button and textbox. In other words, if a button is clicked on, how do I assign it to read that certain textbox where the information was entered?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.