Results 1 to 7 of 7

Thread: Property of a Class..

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    398

    Property of a Class..

    How can i list properties of a class during runtime?
    Thanks

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Property of a Class..

    Adding a reference to library Typelib to your Project you can do it, the only problem is: for some reason it doesn't work when the App is compiled, it only works when running from IDE and I don't know if there is a solution for that. Anyway, in the link below you'll find the code:

    http://www.vbforums.com/showthread.php?t=476509
    Last edited by jcis; Oct 11th, 2011 at 01:03 AM.

  3. #3
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    Re: Property of a Class..

    Here's another method you can try:

    'The code below dumps a list of properties, methods, and events of your
    'class from Object Browser, so you can easily write code to save the
    'contents. It uses SendKeys and copy from the Clipboard.

    'To use it, bring up Object Browser(F2), then select your
    'project name from the list, then click on your class.
    'You would see the list of properties on the right pane.
    'Right click anywhere and make sure that "Group Members"
    'is selected. Click on the first property on the right pane,
    'then start a new VB IDE instance, add a Timer to Form1,
    'then add the code below. Run the project,
    'AND SWITCH to the VB IDE that is showing Object Browser.
    'After 5 seconds, the running program
    'will capture property names and print them to the immediate
    'window. From there, you can copy them and do with them
    'whatever you want.
    Code:
    Option Explicit
    Private Sub Form_Load()
     Timer1.Interval = 5000
    End Sub
    Private Sub Timer1_Timer()
     Timer1.Enabled = False
     DumpObjectBrowser
    End Sub
    Private Sub DumpObjectBrowser()
     Dim Str As String
     Dim LastStr As String
     Dim Counter As Long
    
     Clipboard.Clear
     Counter = 0
     Do
      LastStr = Str
      SendKeys "^c", True
      Delay 0.1
      Str = Clipboard.GetText
      If LastStr = Str Then
       ' We reached the end
       Exit Do
      End If
      Debug.Print Str
      SendKeys "{DOWN}", True
      Delay 0.1
      Counter = Counter + 1
     Loop Until Counter = 100
     Me.Caption = "Done!"
    End Sub
    Private Sub Delay(ByVal Seconds As Single)
     Dim t As Single
    
     t = Timer
     Do While Abs(Timer - t) < Seconds
      DoEvents
     Loop
    End Sub

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Property of a Class..

    what you need is a typelib viewer...
    plenty out there:
    http://www.google.com/search?aq=0&oq...typelib+viewer

    -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??? *

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    398

    Re: Property of a Class..

    but how can i do it during runtime? i want to list all the property of my class and its values during runtime.

  6. #6
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Smile Re: Property of a Class..

    but how can i do it during runtime? i want to list all the property of my class and its values during runtime.
    you cannot see the property of classes at runtime .because all the these things are hidded in vb6.it is possible in only in c# .but i did not
    understand why do you want to see all the property of any class at runtime ?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    398

    Re: Property of a Class..

    i want to create a system log. I will store the previous data in a objectA(class) and to new data to objectB(class). then loop to its property to determine what values are different. then save it to a text file.

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