Results 1 to 5 of 5

Thread: how to display the object datatype output into a text box.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    how to display the object datatype output into a text box.

    how to convert the 'object' datatype into an integer and display it on the text box.

    dim o as object
    o = SqlHelper.ExecuteScalar(connection, "CountProductsByCategory", 1)

    The variable 'o' has the correct output (single value) but how should I use CTYPE to convert it into the integer/string to display on the text box?

    thanks
    nath

  2. #2
    Addicted Member
    Join Date
    Aug 2003
    Posts
    153
    2 Methods

    Dim myInteger As Integer

    myInteger = CInt(o)

    Or

    myInteger = CType(o, Integer)

  3. #3
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    Integer.Parse(o) might also work.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    THANK YOU BOTH...

    THANK YOU

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Or use the Convert static method :

    VB Code:
    1. Dim o As Object
    2. Dim int As Integer = Convert.ToInt32(o)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width