Business Object Problem

  • Thread starter Sparky Arbuckle
  • Start date
S

Sparky Arbuckle

----------------------------------------
..vb Code

Imports System

Namespace ValidateComponents

Dim res As Boolean
Dim strISBN as string = tbISBNNumber.text
Dim checkISBN as string
Dim Number As String
Dim CheckDigit As String
Dim CheckValue As Integer
Dim CheckSum As Integer
Dim i As Byte
Dim Cnt As Byte

res = False
CheckDigit = UCase(Right(strISBN, 1))
Number = Trim(Replace(Left(strISBN, Len(strISBN) - 1), "-", ""))


IF (Len(Number) = 9) And (InStr(1, "0123456789X", CheckDigit) > 0)
THEN


IF CheckDigit = "X" THEN
CheckSum = 10

ELSE

CheckSum = CInt(CheckDigit)

END IF

Cnt = 1


FOR i = 1 To 9
CheckSum = CheckSum + CInt(Mid(Number, i, 1)) * (11 - Cnt)
Cnt = Cnt + 1
NEXT

IF (CheckSum Mod 11 = 0) THEN res = True
END IF

checkISBN = res

END Namespace

------------------------------------------------
..aspx page CODE

Sub ValidateISBN(s as Object, e As ServerValidateEventArgs)

Dim objValidateISBN as New ValidateISBN
lblResult.text = objValidateISBN.ValidateISBN(e.value)

END Sub

Sub Button_Click(s as Object, e as EventArgs)

IF IsValid THEN lblResult.text = "a"
IF NOT IsValid THEN lblResult.text = "b"

END Sub
----------------------------------------

The problem I am having is that the text in lblResult is not b when I
input an invalid ISBN. If res = TRUE then it is valid and if res =
FALSE then the ISBN is invalid. I don't know how to pass the value of
res from the Business object to the .aspx page. I imported the same
namespace so I know that isn't the problem. Any suggestions?
 
K

Kevin Spencer

null in C#.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,098
Latest member
KetoBaseReview
Top