Help With Business Objects

Discussion in 'ASP .Net' started by Sparky Arbuckle, Apr 11, 2005.

  1. How do I successfully pass a value my Business object (.vb) to my .aspx
    page? Right now I am trying to use this:

    Imports System
    Imports Microsoft.VisualBasic

    Namespace ASDFComponents

    Public Class ValidateISBN

    Public res As Boolean
    Public checkISBN as string
    Public Number As String
    Public CheckDigit As String
    Public CheckValue As Integer
    Public CheckSum As Integer
    Public i As Byte
    Public Cnt As Byte

    Public Function ValidateISBN(strISBN as string)

    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

    RETURN res

    END Function

    END Class

    END Namespace


    --------------------

    This is how I try and call that:

    Sub Button_Click(s as Object, e as EventArgs)

    Dim objValidateISBN as New ValidateISBN
    objValidateISBN.strISBN = tbISBNNumber.text
    lblResult.text = objValidateISBN.ValidateISBN(e.Value)
    END Sub

    When I call this in my .aspx page I get the following error:

    Compiler Error Message: BC30456: 'strISBN' is not a member of
    'ASDFComponents.ValidateISBN'.


    Does anyone see what exactly it is that I'm doing wrong? I've uploaded
    a .dll file that I compiled into my /bin directory. I'm stuck!
    Sparky Arbuckle, Apr 11, 2005
    #1
    1. Advertising

  2. There is no variable or property named strISBN.

    Your code should look like:

    Sub Button_Click(s as Object, e as EventArgs)

    Dim objValidateISBN as New ValidateISBN

    lblResult.text = objValidateISBN.ValidateISBN(tbISBNNumber.Text)
    END Sub


    "Sparky Arbuckle" <> wrote in message
    news:...
    > How do I successfully pass a value my Business object (.vb) to my .aspx
    > page? Right now I am trying to use this:
    >
    > Imports System
    > Imports Microsoft.VisualBasic
    >
    > Namespace ASDFComponents
    >
    > Public Class ValidateISBN
    >
    > Public res As Boolean
    > Public checkISBN as string
    > Public Number As String
    > Public CheckDigit As String
    > Public CheckValue As Integer
    > Public CheckSum As Integer
    > Public i As Byte
    > Public Cnt As Byte
    >
    > Public Function ValidateISBN(strISBN as string)
    >
    > 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
    >
    > RETURN res
    >
    > END Function
    >
    > END Class
    >
    > END Namespace
    >
    >
    > --------------------
    >
    > This is how I try and call that:
    >
    > Sub Button_Click(s as Object, e as EventArgs)
    >
    > Dim objValidateISBN as New ValidateISBN
    > objValidateISBN.strISBN = tbISBNNumber.text
    > lblResult.text = objValidateISBN.ValidateISBN(e.Value)
    > END Sub
    >
    > When I call this in my .aspx page I get the following error:
    >
    > Compiler Error Message: BC30456: 'strISBN' is not a member of
    > 'ASDFComponents.ValidateISBN'.
    >
    >
    > Does anyone see what exactly it is that I'm doing wrong? I've uploaded
    > a .dll file that I compiled into my /bin directory. I'm stuck!
    >
    Steven Berkovitz, Apr 11, 2005
    #2
    1. Advertising

  3. hi sparky

    u hav'nt used return type boolean in ur function
    try with this: Public Function ValidateISBN(strISBN as string) as boolean

    "Sparky Arbuckle" wrote:

    > How do I successfully pass a value my Business object (.vb) to my .aspx
    > page? Right now I am trying to use this:
    >
    > Imports System
    > Imports Microsoft.VisualBasic
    >
    > Namespace ASDFComponents
    >
    > Public Class ValidateISBN
    >
    > Public res As Boolean
    > Public checkISBN as string
    > Public Number As String
    > Public CheckDigit As String
    > Public CheckValue As Integer
    > Public CheckSum As Integer
    > Public i As Byte
    > Public Cnt As Byte
    >
    > Public Function ValidateISBN(strISBN as string)
    >
    > 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
    >
    > RETURN res
    >
    > END Function
    >
    > END Class
    >
    > END Namespace
    >
    >
    > --------------------
    >
    > This is how I try and call that:
    >
    > Sub Button_Click(s as Object, e as EventArgs)
    >
    > Dim objValidateISBN as New ValidateISBN
    > objValidateISBN.strISBN = tbISBNNumber.text
    > lblResult.text = objValidateISBN.ValidateISBN(e.Value)
    > END Sub
    >
    > When I call this in my .aspx page I get the following error:
    >
    > Compiler Error Message: BC30456: 'strISBN' is not a member of
    > 'ASDFComponents.ValidateISBN'.
    >
    >
    > Does anyone see what exactly it is that I'm doing wrong? I've uploaded
    > a .dll file that I compiled into my /bin directory. I'm stuck!
    >
    >
    =?Utf-8?B?c3JpZGhhcg==?=, Apr 22, 2005
    #3
  4. "Sparky Arbuckle" wrote:

    > How do I successfully pass a value my Business object (.vb) to my .aspx
    > page? Right now I am trying to use this:
    >
    > Imports System
    > Imports Microsoft.VisualBasic
    >
    > Namespace ASDFComponents
    >
    > Public Class ValidateISBN
    >
    > Public res As Boolean
    > Public checkISBN as string
    > Public Number As String
    > Public CheckDigit As String
    > Public CheckValue As Integer
    > Public CheckSum As Integer
    > Public i As Byte
    > Public Cnt As Byte
    >
    > Public Function ValidateISBN(strISBN as string)
    >
    > 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
    >
    > RETURN res
    >
    > END Function
    >
    > END Class
    >
    > END Namespace
    >
    >
    > --------------------
    >
    > This is how I try and call that:
    >
    > Sub Button_Click(s as Object, e as EventArgs)
    >
    > Dim objValidateISBN as New ValidateISBN
    > objValidateISBN.strISBN = tbISBNNumber.text
    > lblResult.text = objValidateISBN.ValidateISBN(e.Value)
    > END Sub
    >
    > When I call this in my .aspx page I get the following error:
    >
    > Compiler Error Message: BC30456: 'strISBN' is not a member of
    > 'ASDFComponents.ValidateISBN'.
    >
    >
    > Does anyone see what exactly it is that I'm doing wrong? I've uploaded
    > a .dll file that I compiled into my /bin directory. I'm stuck!
    >
    >
    =?Utf-8?B?c3JpZGhhcg==?=, Apr 22, 2005
    #4
  5. hi sparky ,
    try with this modified code:

    ..........................................................................................................................
    Imports System
    Imports Microsoft.VisualBasic

    Namespace ASDFComponents

    Public Class ValidateISBN

    Public res As Boolean
    Public checkISBN as string
    Public Number As String
    Public CheckDigit As String
    Public CheckValue As Integer
    Public CheckSum As Integer
    Public i As Byte
    Public Cnt As Byte

    Public Function ValidateISBN(strISBN as string) as boolean
    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

    RETURN res

    END Function

    END Class

    END Namespace


    --------------------

    and then modify:

    imports ASDFComponents

    Sub Button_Click(s as Object, e as EventArgs)

    Dim objValidateISBN as New ValidateISBN
    objValidateISBN( tbISBNNumber.text)
    lblResult.text = objValidateISBN.ValidateISBN(e.Value)
    END Sub
    ...............................................
    =?Utf-8?B?c3JpZGhhcg==?=, Apr 22, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    391
    Stylus Studio
    Feb 17, 2006
  2. =?Utf-8?B?R3V5IFRob3JudG9u?=

    Needing some help with Business Objects in ASP.Net PLEASE

    =?Utf-8?B?R3V5IFRob3JudG9u?=, Nov 9, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    329
    =?Utf-8?B?R3V5IFRob3JudG9u?=
    Nov 9, 2006
  3. GOOD LUCK GROUP
    Replies:
    0
    Views:
    387
    GOOD LUCK GROUP
    Apr 28, 2008
  4. Mohammed Imran
    Replies:
    0
    Views:
    281
    Mohammed Imran
    Mar 25, 2013
  5. Mohammed Imran
    Replies:
    1
    Views:
    472
Loading...

Share This Page