Results 1 to 2 of 2

Thread: display class object

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    75

    display class object

    why there is a problem in this code??
    i want to display the Clock object

    Class Clock
    public Second as integer
    public Minute as integer
    public Hour as integer

    sub SetTime(intSec as integer, intMin as integer, intHour as integer)
    Second = intSec
    Minute = intMin
    Hour = intHour
    end sub

    sub ShowTime()
    dim showClock as new Clock
    Response.Write(showClock.Second)
    end sub
    End Class

    sub Page_Load(obj as object, e as eventargs)
    dim objClock as new Clock
    objClock.SetTime(60,4,12)
    objClock.ShowTime

    end sub
    </script>
    <body MS_POSITIONING="GridLayout">
    </body>
    </HTML>

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: display class object

    Well... here's what jumps out at me.

    1) dim showClock as new Clock <-- I don't think you can define a variable of a class inside the class....
    2) ShowTime only shows the seconds.... but it's the seconds property of the object it can't create.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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