Runtime error 91


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Runtime error 91

  1. #1
    Join Date
    Mar 2005
    Posts
    110

    Angry Runtime error 91

    When I test my class, I met this problem, "runtime error 91: object variable or within block variable not set"

    this is my test code:

    Option Explicit
    Dim ctest As clsexport


    Private Sub Command1_Click()
    With ctest
    .CName = "name"
    .userID = "123456"
    .C_export
    End With
    End Sub


    partly code in my class

    Public m_userID As String
    Public m_CrName As String

    Public Property Get userID() As Variant
    userID= m_userID
    End Property

    Public Property Let userID(ByVal vNewValue As Variant)
    m_userID = vNewValue
    End Property

    Public Property Get CName() As Variant
    CName = m_Name
    End Property

    Public Property Let CName(ByVal vNewValue As Variant)
    m_CrName = vNewValue
    End Property

    I don't know how to troubleshot this error.

    great appreciated any help!

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    Are you creating an instance of clsexport anywhere?

    Set ctest = New clsexport
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    open the project in the IDE, go to Tools->Options and in the General tab select "Break on all errors". Run with a full compile (Ctrl+F5) to catch compiler errors before hand. The IDE will stop at the line with the offending error. There you can see which object is not defined.
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center