944,142 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 341
  • VB.NET RSS
Nov 2nd, 2009
0

help with windows form applications

Expand Post »
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:
VB.NET Syntax (Toggle Plain Text)
  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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pinkladyxo is offline Offline
2 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: A lot of subs into only one
Next Thread in VB.NET Forum Timeline: FTP url in address bar??





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC