help with windows form applications

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2009
Posts: 2
Reputation: pinkladyxo is an unknown quantity at this point 
Solved Threads: 0
pinkladyxo pinkladyxo is offline Offline
Newbie Poster

help with windows form applications

 
0
  #1
25 Days Ago
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:
  1. Select Case ISBN.Length
  2. Case 10
  3. Dim x As Integer = 0
  4. noCheck = ISBN.Substring(0, ISBN.Length - 1)
  5. x = checkISBN10(ISBN, noCheck)
  6. If x = 11 Then
  7. noCheck += "0"
  8. ElseIf x = 10 Then
  9. noCheck += "X"
  10. Else
  11. noCheck += x.ToString
  12. End If
  13. If (ISBN <> noCheck) Then
  14. System.Console.WriteLine("Invalid ISBN - Check digit is " & x)
  15. End If
  16. Case Else
  17. System.Console.WriteLine("Invalid ISBN length")
  18. End Select
  19.  
  20. Private Function checkISBN10( _
  21. ByVal ISBN As String, ByVal noCheck As String) As Integer
  22. Dim x As Integer = 0
  23. If ISBN.Length = 10 Then
  24. x = 10 * Integer.Parse(noCheck.Chars(0))
  25. x += 9 * Integer.Parse(noCheck.Chars(1))
  26. x += 8 * Integer.Parse(noCheck.Chars(2))
  27. x += 7 * Integer.Parse(noCheck.Chars(3))
  28. x += 6 * Integer.Parse(noCheck.Chars(4))
  29. x += 5 * Integer.Parse(noCheck.Chars(5))
  30. x += 4 * Integer.Parse(noCheck.Chars(6))
  31. x += 3 * Integer.Parse(noCheck.Chars(7))
  32. x += 2 * Integer.Parse(noCheck.Chars(8))
  33. x = 11 - (x Mod 11)
  34. End If
  35. Return x
  36. 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?
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC