-
Oct 10th, 2011, 08:37 AM
#1
Thread Starter
Hyperactive Member
Property of a Class..
How can i list properties of a class during runtime?
Thanks
-
Oct 11th, 2011, 12:53 AM
#2
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.
-
Oct 11th, 2011, 08:04 AM
#3
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
-
Oct 11th, 2011, 11:04 AM
#4
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
-
Oct 16th, 2011, 08:46 PM
#5
Thread Starter
Hyperactive Member
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.
-
Oct 17th, 2011, 07:46 AM
#6
Frenzied Member
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 ?
-
Oct 17th, 2011, 11:03 PM
#7
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|