From df.waters at comcast.net Tue Oct 8 15:24:50 2013 From: df.waters at comcast.net (Dan Waters) Date: Tue, 8 Oct 2013 15:24:50 -0500 Subject: [dba-VB] Using Interfaces Message-ID: <005201cec464$70dc69f0$52953dd0$@comcast.net> Hello! I've been struggling with using an interface to be able to call a referencing project from a referenced project. In Access you just use the Application.run("[ProcedureName]",arg1, arg2 .) statement. But in VB or C# there's not a direct equivalent. This can be done - and using an interface is the way to go. But I've been trying to make this work for 4 days now and I need to reach out to a more knowledgeable person than me. The simplest explanation is at: http://stackoverflow.com/questions/3765177/solve-circular-references-without -introducing-a-new-project. The 2nd entry has what appears to be a simple explanation of what to do. I can make the interface, and the procedure which implements it, but the other 2 parts I can't make work. If you'd like to try this let me know. I've put together a small VB app (VS 2010) which has all the pieces which I can email as an attachment. Thanks! Dan From davidmcafee at gmail.com Tue Oct 8 15:35:02 2013 From: davidmcafee at gmail.com (David McAfee) Date: Tue, 8 Oct 2013 13:35:02 -0700 Subject: [dba-VB] Using Interfaces In-Reply-To: <005201cec464$70dc69f0$52953dd0$@comcast.net> References: <005201cec464$70dc69f0$52953dd0$@comcast.net> Message-ID: Would either of these work for you? C#: Process.Start("https://login.mocproducts.com/"); In VB.Net: If File.Exists(LocPath + NewVersion) Then System.Diagnostics.Process.Start(LocPath + NewVersion) Else MsgBox("Cannot find " & LocPath & NewVersion & ".", vbOKOnly, "unable to start RRMS") End If On Tue, Oct 8, 2013 at 1:24 PM, Dan Waters wrote: > Hello! > > > > I've been struggling with using an interface to be able to call a > referencing project from a referenced project. In Access you just use the > Application.run("[ProcedureName]",arg1, arg2 .) statement. But in VB or C# > there's not a direct equivalent. > > > > This can be done - and using an interface is the way to go. But I've been > trying to make this work for 4 days now and I need to reach out to a more > knowledgeable person than me. > > > > The simplest explanation is at: > > http://stackoverflow.com/questions/3765177/solve-circular-references-without > -introducing-a-new-project. The 2nd entry has what appears to be a simple > explanation of what to do. I can make the interface, and the procedure > which implements it, but the other 2 parts I can't make work. > > > > If you'd like to try this let me know. I've put together a small VB app > (VS > 2010) which has all the pieces which I can email as an attachment. > > > > Thanks! > > Dan > > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From df.waters at comcast.net Tue Oct 8 16:05:36 2013 From: df.waters at comcast.net (Dan Waters) Date: Tue, 8 Oct 2013 16:05:36 -0500 Subject: [dba-VB] Using Interfaces In-Reply-To: References: <005201cec464$70dc69f0$52953dd0$@comcast.net> Message-ID: <005a01cec46a$22b4e120$681ea360$@comcast.net> Hi David, I think you may have answered someone else's question. Dan -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Tuesday, October 08, 2013 3:35 PM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Using Interfaces Would either of these work for you? C#: Process.Start("https://login.mocproducts.com/"); In VB.Net: If File.Exists(LocPath + NewVersion) Then System.Diagnostics.Process.Start(LocPath + NewVersion) Else MsgBox("Cannot find " & LocPath & NewVersion & ".", vbOKOnly, "unable to start RRMS") End If On Tue, Oct 8, 2013 at 1:24 PM, Dan Waters wrote: > Hello! > > > > I've been struggling with using an interface to be able to call a > referencing project from a referenced project. In Access you just use > the Application.run("[ProcedureName]",arg1, arg2 .) statement. But in > VB or C# there's not a direct equivalent. > > > > This can be done - and using an interface is the way to go. But I've > been trying to make this work for 4 days now and I need to reach out > to a more knowledgeable person than me. > > > > The simplest explanation is at: > > http://stackoverflow.com/questions/3765177/solve-circular-references-w > ithout -introducing-a-new-project. The 2nd entry has what appears to > be a simple explanation of what to do. I can make the interface, and > the procedure which implements it, but the other 2 parts I can't make > work. > > > > If you'd like to try this let me know. I've put together a small VB > app (VS > 2010) which has all the pieces which I can email as an attachment. > > > > Thanks! > > Dan > > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mcp2004 at mail.ru Wed Oct 9 01:44:48 2013 From: mcp2004 at mail.ru (=?UTF-8?B?U2FsYWtoZXRkaW5vdiBTaGFtaWw=?=) Date: Wed, 09 Oct 2013 10:44:48 +0400 Subject: [dba-VB] =?utf-8?q?Using_Interfaces?= In-Reply-To: <005201cec464$70dc69f0$52953dd0$@comcast.net> References: <005201cec464$70dc69f0$52953dd0$@comcast.net> Message-ID: <1381301088.99214998@f334.i.mail.ru> Hello Dan -- Yes, it should work. You can send me your sample project off-line to fix. But I use VS2012. Anyway the issue should have similar solution for VS2010 and VS2012. So you have a project B, which referencing project A B -> A but some functionality to call from 'Project A' code is located in 'Project B', and you can't set a reference from 'Project A' to 'Project B' A -> B because in this case you'll get a circular reference B <-> A and VS2010 etc. do not support circular references. And you do not want to move code from 'Project B' into a new 'Project C' as that moving would require a lot of work. So you define an interface in 'Project A', let's call it IMyCallBackToProjectB with a method CallMe then you create a facade class in 'Project B' implementing?IMyCallBackToProjectB interface's method CallMe handling instance(s) of 'Project B' classes to be called from 'Project A' code, or just implement that interface in your 'Project B' class, which instance methods/functionality should be called from 'Project A'. And you'll have to add instance reference to IMyCallBackToProjectB interface?to all your calls to 'Project A' methods, which need calling back 'Project B' functionality. Or you can just have a global variable ( coding purists keep silent please!) in 'Project A' keeping reference to 'Project B' instance implementing?IMyCallBackToProjectB interface. That instance reference can be created on program start-up. Don't forget to set it to null and program exiting, otherwise you'll have a chance to get your program left hanging in memory in 'ghost mode' on exiting. I hope I haven't made the subject even more obscure than it was presented/discussed here before I have posted these my remarks. Thank you. - Shamil ? Tuesday, October 8, 2013 3:24 PM -05:00 from "Dan Waters" : >Hello! > >? > >I've been struggling with using an interface to be able to call a >referencing project from a referenced project. In Access you just use the >Application.run("[ProcedureName]",arg1, arg2 .) statement. But in VB or C# >there's not a direct equivalent. > >? > >This can be done - and using an interface is the way to go. But I've been >trying to make this work for 4 days now and I need to reach out to a more >knowledgeable person than me. > >? > >The simplest explanation is at: >http://stackoverflow.com/questions/3765177/solve-circular-references-without >-introducing-a-new-project. The 2nd entry has what appears to be a simple >explanation of what to do. I can make the interface, and the procedure >which implements it, but the other 2 parts I can't make work. > >? > >If you'd like to try this let me know. I've put together a small VB app (VS >2010) which has all the pieces which I can email as an attachment. > >? > >Thanks! > >Dan > >? > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > -- ???????????? ?????? From df.waters at comcast.net Wed Oct 9 10:02:57 2013 From: df.waters at comcast.net (Dan Waters) Date: Wed, 9 Oct 2013 10:02:57 -0500 Subject: [dba-VB] Using Interfaces In-Reply-To: <1381301088.99214998@f334.i.mail.ru> References: <005201cec464$70dc69f0$52953dd0$@comcast.net> <1381301088.99214998@f334.i.mail.ru> Message-ID: <001201cec500$a4a016f0$ede044d0$@comcast.net> Hi Shamil - I sent the app off-line. Good Luck! Dan -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil Sent: Wednesday, October 09, 2013 1:45 AM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Using Interfaces Hello Dan -- Yes, it should work. You can send me your sample project off-line to fix. But I use VS2012. Anyway the issue should have similar solution for VS2010 and VS2012. So you have a project B, which referencing project A B -> A but some functionality to call from 'Project A' code is located in 'Project B', and you can't set a reference from 'Project A' to 'Project B' A -> B because in this case you'll get a circular reference B <-> A and VS2010 etc. do not support circular references. And you do not want to move code from 'Project B' into a new 'Project C' as that moving would require a lot of work. So you define an interface in 'Project A', let's call it IMyCallBackToProjectB with a method CallMe then you create a facade class in 'Project B' implementing IMyCallBackToProjectB interface's method CallMe handling instance(s) of 'Project B' classes to be called from 'Project A' code, or just implement that interface in your 'Project B' class, which instance methods/functionality should be called from 'Project A'. And you'll have to add instance reference to IMyCallBackToProjectB interface to all your calls to 'Project A' methods, which need calling back 'Project B' functionality. Or you can just have a global variable ( coding purists keep silent please!) in 'Project A' keeping reference to 'Project B' instance implementing IMyCallBackToProjectB interface. That instance reference can be created on program start-up. Don't forget to set it to null and program exiting, otherwise you'll have a chance to get your program left hanging in memory in 'ghost mode' on exiting. I hope I haven't made the subject even more obscure than it was presented/discussed here before I have posted these my remarks. Thank you. - Shamil Tuesday, October 8, 2013 3:24 PM -05:00 from "Dan Waters" : >Hello! > > > >I've been struggling with using an interface to be able to call a >referencing project from a referenced project. In Access you just use >the Application.run("[ProcedureName]",arg1, arg2 .) statement. But in >VB or C# there's not a direct equivalent. > > > >This can be done - and using an interface is the way to go. But I've >been trying to make this work for 4 days now and I need to reach out to >a more knowledgeable person than me. > > > >The simplest explanation is at: >http://stackoverflow.com/questions/3765177/solve-circular-references-wi >thout -introducing-a-new-project. The 2nd entry has what appears to be >a simple explanation of what to do. I can make the interface, and the >procedure which implements it, but the other 2 parts I can't make work. > > > >If you'd like to try this let me know. I've put together a small VB >app (VS >2010) which has all the pieces which I can email as an attachment. > > > >Thanks! > >Dan > > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > -- ???????????? ?????? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mcp2004 at mail.ru Wed Oct 9 16:28:31 2013 From: mcp2004 at mail.ru (=?UTF-8?B?U2FsYWtoZXRkaW5vdiBTaGFtaWw=?=) Date: Thu, 10 Oct 2013 01:28:31 +0400 Subject: [dba-VB] =?utf-8?q?Using_Interfaces?= In-Reply-To: <001201cec500$a4a016f0$ede044d0$@comcast.net> References: <005201cec464$70dc69f0$52953dd0$@comcast.net> <1381301088.99214998@f334.i.mail.ru> <001201cec500$a4a016f0$ede044d0$@comcast.net> Message-ID: <1381354111.816439413@f53.i.mail.ru> Hi Dan -- Solution sent back offline, one of "myriads" of possible solutions - it all depends on one coding style/taste. I must note VB.NET is a RPITA. (And I have been programming on VBA/VB6 for 10+ years, fulltime - 1994 - 2004+) Forget it - switch to C#! Thank you. -- Shamil Wednesday, October 9, 2013 10:02 AM -05:00 from "Dan Waters" : >Hi Shamil - I sent the app off-line. > >Good Luck! >Dan > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil >Sent: Wednesday, October 09, 2013 1:45 AM >To: Discussion concerning Visual Basic and related programming issues. >Subject: Re: [dba-VB] Using Interfaces > >?Hello Dan -- > >Yes, it should work. You can send me your sample project off-line to fix. But I use VS2012. Anyway the issue should have similar solution for VS2010 and VS2012. > >So you have a project B, which referencing project A > >B -> A > >but some functionality to call from 'Project A' code is located in 'Project B', and you can't set a reference from 'Project A' to 'Project B' > >A -> B > >because in this case you'll get a circular reference > >B <-> A > >and VS2010 etc. do not support circular references. > >And you do not want to move code from 'Project B' into a new 'Project C' as that moving would require a lot of work. > >So you define an interface in 'Project A', let's call it > >IMyCallBackToProjectB > >with a method CallMe > >then you create a facade class in 'Project B' implementing IMyCallBackToProjectB interface's method CallMe handling instance(s) of 'Project B' classes to be called from 'Project A' code, or just implement that interface in your 'Project B' class, which instance methods/functionality should be called from 'Project A'. And you'll have to add instance reference to IMyCallBackToProjectB interface to all your calls to 'Project A' methods, which need calling back 'Project B' functionality. Or you can just have a global variable ( coding purists keep silent please!) in 'Project A' keeping reference to 'Project B' instance implementing IMyCallBackToProjectB interface. That instance reference can be created on program start-up. Don't forget to set it to null and program exiting, otherwise you'll have a chance to get your program left hanging in memory in 'ghost mode' on exiting. > >I hope I haven't made the subject even more obscure than it was presented/discussed here before I have posted these my remarks. > >Thank you. > >- Shamil >? > >Tuesday, October 8, 2013 3:24 PM -05:00 from "Dan Waters" < df.waters at comcast.net >: >>Hello! >> >> >> >>I've been struggling with using an interface to be able to call a >>referencing project from a referenced project. In Access you just use >>the Application.run("[ProcedureName]",arg1, arg2 .) statement. But in >>VB or C# there's not a direct equivalent. >> >> >> >>This can be done - and using an interface is the way to go. But I've >>been trying to make this work for 4 days now and I need to reach out to >>a more knowledgeable person than me. >> >> >> >>The simplest explanation is at: >> http://stackoverflow.com/questions/3765177/solve-circular-references-wi >>thout -introducing-a-new-project. The 2nd entry has what appears to be >>a simple explanation of what to do. I can make the interface, and the >>procedure which implements it, but the other 2 parts I can't make work. >> >> >> >>If you'd like to try this let me know. I've put together a small VB >>app (VS >>2010) which has all the pieces which I can email as an attachment. >> >> >> >>Thanks! >> >>Dan >> >. -- ???????????? ?????? From df.waters at comcast.net Fri Oct 11 08:42:54 2013 From: df.waters at comcast.net (Dan Waters) Date: Fri, 11 Oct 2013 08:42:54 -0500 Subject: [dba-VB] Using Interfaces In-Reply-To: <1381354111.816439413@f53.i.mail.ru> References: <005201cec464$70dc69f0$52953dd0$@comcast.net> <1381301088.99214998@f334.i.mail.ru> <001201cec500$a4a016f0$ede044d0$@comcast.net> <1381354111.816439413@f53.i.mail.ru> Message-ID: <002201cec687$ca204480$5e60cd80$@comcast.net> Hi Shamil! Excellent! The code you added was never mentioned anywhere in the .net help sites I visited. Yesterday I add the remaining code to call a procedure in the Main project from the referenced project - all works well! About VB.Net - I do like it, but then I've never learned C#. Would the changes you made for my demo been easier with C#? Thanks again!!! Dan -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil Sent: Wednesday, October 09, 2013 4:29 PM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] Using Interfaces Hi Dan -- Solution sent back offline, one of "myriads" of possible solutions - it all depends on one coding style/taste. I must note VB.NET is a RPITA. (And I have been programming on VBA/VB6 for 10+ years, fulltime - 1994 - 2004+) Forget it - switch to C#! Thank you. -- Shamil Wednesday, October 9, 2013 10:02 AM -05:00 from "Dan Waters" : >Hi Shamil - I sent the app off-line. > >Good Luck! >Dan > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov >Shamil >Sent: Wednesday, October 09, 2013 1:45 AM >To: Discussion concerning Visual Basic and related programming issues. >Subject: Re: [dba-VB] Using Interfaces > > Hello Dan -- > >Yes, it should work. You can send me your sample project off-line to fix. But I use VS2012. Anyway the issue should have similar solution for VS2010 and VS2012. > >So you have a project B, which referencing project A > >B -> A > >but some functionality to call from 'Project A' code is located in 'Project B', and you can't set a reference from 'Project A' to 'Project B' > >A -> B > >because in this case you'll get a circular reference > >B <-> A > >and VS2010 etc. do not support circular references. > >And you do not want to move code from 'Project B' into a new 'Project C' as that moving would require a lot of work. > >So you define an interface in 'Project A', let's call it > >IMyCallBackToProjectB > >with a method CallMe > >then you create a facade class in 'Project B' implementing IMyCallBackToProjectB interface's method CallMe handling instance(s) of 'Project B' classes to be called from 'Project A' code, or just implement that interface in your 'Project B' class, which instance methods/functionality should be called from 'Project A'. And you'll have to add instance reference to IMyCallBackToProjectB interface to all your calls to 'Project A' methods, which need calling back 'Project B' functionality. Or you can just have a global variable ( coding purists keep silent please!) in 'Project A' keeping reference to 'Project B' instance implementing IMyCallBackToProjectB interface. That instance reference can be created on program start-up. Don't forget to set it to null and program exiting, otherwise you'll have a chance to get your program left hanging in memory in 'ghost mode' on exiting. > >I hope I haven't made the subject even more obscure than it was presented/discussed here before I have posted these my remarks. > >Thank you. > >- Shamil > > >Tuesday, October 8, 2013 3:24 PM -05:00 from "Dan Waters" < df.waters at comcast.net >: >>Hello! >> >> >> >>I've been struggling with using an interface to be able to call a >>referencing project from a referenced project. In Access you just use >>the Application.run("[ProcedureName]",arg1, arg2 .) statement. But in >>VB or C# there's not a direct equivalent. >> >> >> >>This can be done - and using an interface is the way to go. But I've >>been trying to make this work for 4 days now and I need to reach out >>to a more knowledgeable person than me. >> >> >> >>The simplest explanation is at: >> >>http://stackoverflow.com/questions/3765177/solve-circular-references-w >>i thout -introducing-a-new-project. The 2nd entry has what appears to >>be a simple explanation of what to do. I can make the interface, and >>the procedure which implements it, but the other 2 parts I can't make >>work. >> >> >> >>If you'd like to try this let me know. I've put together a small VB >>app (VS >>2010) which has all the pieces which I can email as an attachment. >> >> >> >>Thanks! >> >>Dan >> >. -- ???????????? ?????? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mcp2004 at mail.ru Fri Oct 11 09:33:13 2013 From: mcp2004 at mail.ru (=?UTF-8?B?U2FsYWtoZXRkaW5vdiBTaGFtaWw=?=) Date: Fri, 11 Oct 2013 18:33:13 +0400 Subject: [dba-VB] =?utf-8?q?Using_Interfaces?= In-Reply-To: <002201cec687$ca204480$5e60cd80$@comcast.net> References: <005201cec464$70dc69f0$52953dd0$@comcast.net> <1381354111.816439413@f53.i.mail.ru> <002201cec687$ca204480$5e60cd80$@comcast.net> Message-ID: <1381501993.1613396@f277.i.mail.ru> Hi Dan -- I'm glad it worked well for you! The current VB.NET and C# version have equal programming power AFAIK. That could be just myself who feels non-comfortable with VB.NET:? - it should have taken a one-two minutes to make your solution working in C#, and with VB.NET it took 5+ minutes here. <<< The code you added was never mentioned anywhere in the .net help sites I visited. >>> StackOverflow has usually answers on most real life programming questions, but sometimes these answers are more hints that ready to use solutions. Thank you. -- Shamil Friday, October 11, 2013 8:42 AM -05:00 from "Dan Waters" : >Hi Shamil! > >Excellent! The code you added was never mentioned anywhere in the .net help sites I visited. > >Yesterday I add the remaining code to call a procedure in the Main project from the referenced project - all works well! > >About VB.Net - I do like it, but then I've never learned C#. Would the changes you made for my demo been easier with C#? > >Thanks again!!! >Dan > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil >Sent: Wednesday, October 09, 2013 4:29 PM >To: 'Discussion concerning Visual Basic and related programming issues.' >Subject: Re: [dba-VB] Using Interfaces > >?Hi Dan -- > >Solution sent back offline, one of "myriads" of possible solutions - it all depends on one coding style/taste. >I must note VB.NET is a RPITA. (And I have been programming on VBA/VB6 for 10+ years, fulltime - 1994 - 2004+) Forget it - switch to C#! > >Thank you. > >-- Shamil > > >Wednesday, October 9, 2013 10:02 AM -05:00 from "Dan Waters" < df.waters at comcast.net >: >>Hi Shamil - I sent the app off-line. >> >>Good Luck! >>Dan >> >>-----Original Message----- >>From: dba-vb-bounces at databaseadvisors.com >>[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov >>Shamil >>Sent: Wednesday, October 09, 2013 1:45 AM >>To: Discussion concerning Visual Basic and related programming issues. >>Subject: Re: [dba-VB] Using Interfaces >> >> Hello Dan -- >> >>Yes, it should work. You can send me your sample project off-line to fix. But I use VS2012. Anyway the issue should have similar solution for VS2010 and VS2012. >> >>So you have a project B, which referencing project A >> >>B -> A >> >>but some functionality to call from 'Project A' code is located in 'Project B', and you can't set a reference from 'Project A' to 'Project B' >> >>A -> B >> >>because in this case you'll get a circular reference >> >>B <-> A >> >>and VS2010 etc. do not support circular references. >> >>And you do not want to move code from 'Project B' into a new 'Project C' as that moving would require a lot of work. >> >>So you define an interface in 'Project A', let's call it >> >>IMyCallBackToProjectB >> >>with a method CallMe >> >>then you create a facade class in 'Project B' implementing IMyCallBackToProjectB interface's method CallMe handling instance(s) of 'Project B' classes to be called from 'Project A' code, or just implement that interface in your 'Project B' class, which instance methods/functionality should be called from 'Project A'. And you'll have to add instance reference to IMyCallBackToProjectB interface to all your calls to 'Project A' methods, which need calling back 'Project B' functionality. Or you can just have a global variable ( coding purists keep silent please!) in 'Project A' keeping reference to 'Project B' instance implementing IMyCallBackToProjectB interface. That instance reference can be created on program start-up. Don't forget to set it to null and program exiting, otherwise you'll have a chance to get your program left hanging in memory in 'ghost mode' on exiting. >> >>I hope I haven't made the subject even more obscure than it was presented/discussed here before I have posted these my remarks. >> >>Thank you. >> >>- Shamil >> >> >>Tuesday, October 8, 2013 3:24 PM -05:00 from "Dan Waters" < df.waters at comcast.net >: >>>Hello! >>> >>> >>> >>>I've been struggling with using an interface to be able to call a >>>referencing project from a referenced project. In Access you just use >>>the Application.run("[ProcedureName]",arg1, arg2 .) statement. But in >>>VB or C# there's not a direct equivalent. >>> >>> >>> >>>This can be done - and using an interface is the way to go. But I've >>>been trying to make this work for 4 days now and I need to reach out >>>to a more knowledgeable person than me. >>> >>> >>> >>>The simplest explanation is at: >>> >>> http://stackoverflow.com/questions/3765177/solve-circular-references-w >>>i thout -introducing-a-new-project. The 2nd entry has what appears to >>>be a simple explanation of what to do. I can make the interface, and >>>the procedure which implements it, but the other 2 parts I can't make >>>work. >>> >>> >>> >>>If you'd like to try this let me know. I've put together a small VB >>>app (VS >>>2010) which has all the pieces which I can email as an attachment. >>> >>> >>> >>>Thanks! >>> >>>Dan >>> >>. > >-- >???????????? ?????? >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > -- ???????????? ?????? From df.waters at comcast.net Fri Oct 11 09:42:06 2013 From: df.waters at comcast.net (Dan Waters) Date: Fri, 11 Oct 2013 09:42:06 -0500 Subject: [dba-VB] Using Interfaces In-Reply-To: <1381501993.1613396@f277.i.mail.ru> References: <005201cec464$70dc69f0$52953dd0$@comcast.net> <1381354111.816439413@f53.i.mail.ru> <002201cec687$ca204480$5e60cd80$@comcast.net> <1381501993.1613396@f277.i.mail.ru> Message-ID: <002801cec690$0ee80500$2cb80f00$@comcast.net> I certainly agree about StackOverflow! It's often my first go-to site when I have a question. Luckily it's only once in a great while that I can't eventually piece together a solution. Thanks! Dan -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil Sent: Friday, October 11, 2013 9:33 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: Re: [dba-VB] Using Interfaces Hi Dan -- I'm glad it worked well for you! The current VB.NET and C# version have equal programming power AFAIK. That could be just myself who feels non-comfortable with VB.NET: - it should have taken a one-two minutes to make your solution working in C#, and with VB.NET it took 5+ minutes here. <<< The code you added was never mentioned anywhere in the .net help sites I visited. >>> StackOverflow has usually answers on most real life programming questions, but sometimes these answers are more hints that ready to use solutions. Thank you. -- Shamil Friday, October 11, 2013 8:42 AM -05:00 from "Dan Waters" : >Hi Shamil! > >Excellent! The code you added was never mentioned anywhere in the .net help sites I visited. > >Yesterday I add the remaining code to call a procedure in the Main project from the referenced project - all works well! > >About VB.Net - I do like it, but then I've never learned C#. Would the changes you made for my demo been easier with C#? > >Thanks again!!! >Dan > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov >Shamil >Sent: Wednesday, October 09, 2013 4:29 PM >To: 'Discussion concerning Visual Basic and related programming issues.' >Subject: Re: [dba-VB] Using Interfaces > > Hi Dan -- > >Solution sent back offline, one of "myriads" of possible solutions - it all depends on one coding style/taste. >I must note VB.NET is a RPITA. (And I have been programming on VBA/VB6 for 10+ years, fulltime - 1994 - 2004+) Forget it - switch to C#! > >Thank you. > >-- Shamil > > >Wednesday, October 9, 2013 10:02 AM -05:00 from "Dan Waters" < df.waters at comcast.net >: >>Hi Shamil - I sent the app off-line. >> >>Good Luck! >>Dan >> >>-----Original Message----- >>From: dba-vb-bounces at databaseadvisors.com >>[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of >>Salakhetdinov Shamil >>Sent: Wednesday, October 09, 2013 1:45 AM >>To: Discussion concerning Visual Basic and related programming issues. >>Subject: Re: [dba-VB] Using Interfaces >> >> Hello Dan -- >> >>Yes, it should work. You can send me your sample project off-line to fix. But I use VS2012. Anyway the issue should have similar solution for VS2010 and VS2012. >> >>So you have a project B, which referencing project A >> >>B -> A >> >>but some functionality to call from 'Project A' code is located in 'Project B', and you can't set a reference from 'Project A' to 'Project B' >> >>A -> B >> >>because in this case you'll get a circular reference >> >>B <-> A >> >>and VS2010 etc. do not support circular references. >> >>And you do not want to move code from 'Project B' into a new 'Project C' as that moving would require a lot of work. >> >>So you define an interface in 'Project A', let's call it >> >>IMyCallBackToProjectB >> >>with a method CallMe >> >>then you create a facade class in 'Project B' implementing IMyCallBackToProjectB interface's method CallMe handling instance(s) of 'Project B' classes to be called from 'Project A' code, or just implement that interface in your 'Project B' class, which instance methods/functionality should be called from 'Project A'. And you'll have to add instance reference to IMyCallBackToProjectB interface to all your calls to 'Project A' methods, which need calling back 'Project B' functionality. Or you can just have a global variable ( coding purists keep silent please!) in 'Project A' keeping reference to 'Project B' instance implementing IMyCallBackToProjectB interface. That instance reference can be created on program start-up. Don't forget to set it to null and program exiting, otherwise you'll have a chance to get your program left hanging in memory in 'ghost mode' on exiting. >> >>I hope I haven't made the subject even more obscure than it was presented/discussed here before I have posted these my remarks. >> >>Thank you. >> >>- Shamil >> >> >>Tuesday, October 8, 2013 3:24 PM -05:00 from "Dan Waters" < df.waters at comcast.net >: >>>Hello! >>> >>> >>> >>>I've been struggling with using an interface to be able to call a >>>referencing project from a referenced project. In Access you just >>>use the Application.run("[ProcedureName]",arg1, arg2 .) statement. >>>But in VB or C# there's not a direct equivalent. >>> >>> >>> >>>This can be done - and using an interface is the way to go. But I've >>>been trying to make this work for 4 days now and I need to reach out >>>to a more knowledgeable person than me. >>> >>> >>> >>>The simplest explanation is at: >>> >>> >>>http://stackoverflow.com/questions/3765177/solve-circular-references- >>>w i thout -introducing-a-new-project. The 2nd entry has what appears >>>to be a simple explanation of what to do. I can make the interface, >>>and the procedure which implements it, but the other 2 parts I can't >>>make work. >>> >>> >>> >>>If you'd like to try this let me know. I've put together a small VB >>>app (VS >>>2010) which has all the pieces which I can email as an attachment. >>> >>> >>> >>>Thanks! >>> >>>Dan >>> >>. > >-- >???????????? ?????? >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > -- ???????????? ?????? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From fuller.artful at gmail.com Wed Oct 30 08:41:44 2013 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 30 Oct 2013 09:41:44 -0400 Subject: [dba-VB] AutoExec in Excel Message-ID: I don't use Excel much any more, but a friend has asked me how to do the equivalent of an AutoExec in VBA for Excel. All he wants to do is set a few properties when he opens a particular spreadsheet. Turns out that only a few properties are persistent; hence the need to set them on opening the workbook. I have no idea how to autoexec from Access. Do you? Is it as simple as declaring the procedure "AutoExec"? -- Arthur From stuart at lexacorp.com.pg Wed Oct 30 15:48:32 2013 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 31 Oct 2013 06:48:32 +1000 Subject: [dba-VB] AutoExec in Excel In-Reply-To: References: Message-ID: <527170A0.28523.26FB0CE8@stuart.lexacorp.com.pg> Either put your code in the Workbook_Open event or create a macro called Auto_Open On 30 Oct 2013 at 9:41, Arthur Fuller wrote: > I don't use Excel much any more, but a friend has asked me how to do > the equivalent of an AutoExec in VBA for Excel. All he wants to do is > set a few properties when he opens a particular spreadsheet. Turns out > that only a few properties are persistent; hence the need to set them > on opening the workbook. I have no idea how to autoexec from Access. > Do you? Is it as simple as declaring the procedure "AutoExec"? > > -- > Arthur > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Wed Oct 30 17:50:39 2013 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 30 Oct 2013 18:50:39 -0400 Subject: [dba-VB] AutoExec in Excel In-Reply-To: <527170A0.28523.26FB0CE8@stuart.lexacorp.com.pg> References: <527170A0.28523.26FB0CE8@stuart.lexacorp.com.pg> Message-ID: Thanks. Stuart! I am threatening to come visit you someday and to retrace Darwin's steps. I am seriously into lizards, and especially of the PNG flavours of same. Don't be surprised if one day I knock upon your door :) On Wed, Oct 30, 2013 at 4:48 PM, Stuart McLachlan wrote: > Either put your code in the Workbook_Open event or create a macro called > Auto_Open > > > On 30 Oct 2013 at 9:41, Arthur Fuller wrote: > > > I don't use Excel much any more, but a friend has asked me how to do > > the equivalent of an AutoExec in VBA for Excel. All he wants to do is > > set a few properties when he opens a particular spreadsheet. Turns out > > that only a few properties are persistent; hence the need to set them > > on opening the workbook. I have no idea how to autoexec from Access. > > Do you? Is it as simple as declaring the procedure "AutoExec"? > > > > -- > > Arthur > > _______________________________________________ > > dba-VB mailing list > > dba-VB at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-vb > > http://www.databaseadvisors.com > > > > > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > -- Arthur