Serving the Quantitative Finance Community

 
User avatar
AlexesDad
Posts: 243
Joined: May 29th, 2009, 4:10 pm

VB/ VBA

June 25th, 2010, 2:42 pm

Because you moronic fool, the obvious solution, using AddressOf to pass the address of a VBA function to a C callback method is simply not good practice so I refrain from suggesting it to anyone. Further more in this case, probably the most sensible thing to do would be to write a if ... else .. endif structure to dispatch to the correct sort method.I have a fair idea what F O A D means. But why PM ? why don't you just openly tell us what it means here ?
 
User avatar
daveangel
Posts: 17031
Joined: October 20th, 2003, 4:05 pm

VB/ VBA

June 25th, 2010, 2:49 pm

QuoteOriginally posted by: AlexesDadBecause you moronic fool, the obvious solution, using AddressOf to pass the address of a VBA function to a C callback method is simply not good practice so I refrain from suggesting it to anyone. Further more in this case, probably the most sensible thing to do would be to write a if ... else .. endif structure to dispatch to the correct sort method.I have a fair idea what F O A D means. But why PM ? why don't you just openly tell us what it means here ?let us see a concrete suggestion from you rather than this vague nonsense.btw I suggest that he used the Run method in his comparison function which then runs the appropriate comparator. this is in VB/VBA. You can see this from my statementQuote In VBA I guess you could pass the name of the comparator and use the Run method ? I never suggested that he uses the AddressOf... so once again FOAD.
knowledge comes, wisdom lingers
 
User avatar
quantmeh
Posts: 5974
Joined: April 6th, 2007, 1:39 pm

VB/ VBA

June 25th, 2010, 2:52 pm

QuoteOriginally posted by: chocolatemoneyThank you guys for the feedback. Actually, my initial inquiry was rather simple: I have a class with several properties. I stick instances of such class in a collection.I have to sort the collection by (several) of those properties (ex class aMan, instances in the Employees collection, and I have to sort the collection by weight, wage, height, age, etc)I'd like to avoid writing a sub for each property I'd like to sort by; subs that would just differ by the if statement where the comparison is made: ex "if man1.age > man2.age then" vs "if man1.wage > man2.wage" etcI was just thinking about the most convenient solution and looking for hints...Thank you.this is what you need reflection in VB
 
User avatar
AlexesDad
Posts: 243
Joined: May 29th, 2009, 4:10 pm

VB/ VBA

June 25th, 2010, 3:31 pm

JawabeanFrom the title of the thread (VB/VBA), it is suggestive that he is not using VB.NET but either VBA or VB6. Your link is to reflection for VB.NET.Daveangel,If FOAD means what i think it means, then wishing me death .... it's a bit over the top don't you think. Do you react like this to anyone who dares to question your methods that you openly share in a public forum ?
 
User avatar
daveangel
Posts: 17031
Joined: October 20th, 2003, 4:05 pm

VB/ VBA

June 25th, 2010, 4:50 pm

QuoteOriginally posted by: AlexesDadJawabeanFrom the title of the thread (VB/VBA), it is suggestive that he is not using VB.NET but either VBA or VB6. Your link is to reflection for VB.NET.Daveangel,If FOAD means what i think it means, then wishing me death .... it's a bit over the top don't you think. Do you react like this to anyone who dares to question your methods that you openly share in a public forum ?why do you think its VB.NET ? The Run method is uspported in VBA which is what i was responding to.so where is your solution? I still haven't see it ... I still think you are a troll.I didnt think you were so thin skinned to take offence over FOAD
knowledge comes, wisdom lingers
 
User avatar
quantmeh
Posts: 5974
Joined: April 6th, 2007, 1:39 pm

VB/ VBA

June 25th, 2010, 4:50 pm

QuoteOriginally posted by: AlexesDadJawabeanFrom the title of the thread (VB/VBA), it is suggestive that he is not using VB.NET but either VBA or VB6.he's not saying VB6. anyways, he should stop using VB6.and how did you devise that it's he not she?
 
User avatar
AlexesDad
Posts: 243
Joined: May 29th, 2009, 4:10 pm

VB/ VBA

June 25th, 2010, 5:21 pm

QuoteOriginally posted by: daveangelI didnt think ..... AHHH well, that explains it. Now it's all clear. You were attempting to think. Seriously, don't do that, leave it to the rest of us. You'll make yourself ill.
 
User avatar
daveangel
Posts: 17031
Joined: October 20th, 2003, 4:05 pm

VB/ VBA

June 25th, 2010, 5:27 pm

QuoteOriginally posted by: AlexesDadQuoteOriginally posted by: daveangelI didnt think ..... AHHH well, that explains it. Now it's all clear. You were attempting to think. Seriously, don't do that, leave it to the rest of us. You'll make yourself ill.lets see your solution ... as usual you are talking out of your sphincter.where did I say anything about VB.NET or AddressOf ?
knowledge comes, wisdom lingers
 
User avatar
Cuchulainn
Posts: 65000
Joined: July 16th, 2004, 7:38 am
Location: Ganymede

VB/ VBA

June 25th, 2010, 6:35 pm

AlxesDad,Is this you comeback/gatecrash trick .. insulting everyone after a long absence?I expected some new on xlwplus.
Last edited by Cuchulainn on June 24th, 2010, 10:00 pm, edited 1 time in total.
65000
 
User avatar
chocolatemoney
Topic Author
Posts: 322
Joined: October 8th, 2008, 6:50 am

VB/ VBA

June 28th, 2010, 9:04 am

Thanks again for the hints. I'm having a look. Hope I'll get the program up and running soon
 
User avatar
dd3
Posts: 246
Joined: June 8th, 2010, 9:02 am

VB/ VBA

June 28th, 2010, 10:02 am

QuoteOriginally posted by: rmaxI remember many years ago when dinosaurs walked the earth that I did do some code in VB6 using ObjPtr. It is an undocumented function, and had serious health warnings on it. There was a VarPtr function as well. I don't know if you could use that.Otherwise, I would store the properties in a collection and sort using that.There are 3 pointer functions in VB, VarPtr, ObjPtr and StrPtr (at least with VB6)From my own personal usage, VarPtr is the most similar to C/C++'s & functionality, I used to to pass pointers to VB Types in my program to some Windows APIs.I've not used the other two. I doubt they're helpful unless you're working on the internals of the VB VM.
 
User avatar
rmax
Posts: 6080
Joined: December 8th, 2005, 9:31 am

VB/ VBA

July 2nd, 2010, 10:32 am

QuoteOriginally posted by: dd3QuoteOriginally posted by: rmaxI remember many years ago when dinosaurs walked the earth that I did do some code in VB6 using ObjPtr. It is an undocumented function, and had serious health warnings on it. There was a VarPtr function as well. I don't know if you could use that.Otherwise, I would store the properties in a collection and sort using that.There are 3 pointer functions in VB, VarPtr, ObjPtr and StrPtr (at least with VB6)I doubt they're helpful unless you're working on the internals of the VB VM.When I started I thought it was pretty cool that they moved from the VB3 virtual machine to proper assembler! Are the ptr functions supported in the VM?
 
User avatar
dd3
Posts: 246
Joined: June 8th, 2010, 9:02 am

VB/ VBA

July 6th, 2010, 8:38 pm

Yes, VB compiles to machine code, but your program/library will still link to the VB runtime DLL during compilation.If it's missing your program won't work, native or not. It's essentially VB's version of msvcrt.dll.
 
User avatar
quantmeh
Posts: 5974
Joined: April 6th, 2007, 1:39 pm

VB/ VBA

July 6th, 2010, 9:54 pm

QuoteOriginally posted by: dd3Yes, VB compiles to machine codeWTF?!
 
User avatar
dd3
Posts: 246
Joined: June 8th, 2010, 9:02 am

VB/ VBA

July 7th, 2010, 12:13 pm

Starting with VB6 (I think) you could choose between native or interpreted execution