|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Two Relatively Simple QuestionsI have four Visual Basic .Net projects in my Visual Studio solution. Each project modifies and/or uses information in four random access files in different ways. Hence a large portion of code is shared between two or more of these four projects. This leads to difficulties, since modifications to code in one project must be mirrored in the other projects to prevent bugs & errors. For example, I eventually traced one nasty bug that caused a display error in a ListBox to my failure to modify a <VBFixedString(15)> that I'd increased to 17 in the other projects. Can I solve this by adding the same module to each of my four projects and declaring variables common to all of them only in there? (Would this also allow me to have routines common to all projects?) Second, I reference those four files using the following constants: Const PointsFile = "C:\Bike Racer\Shared Data\Points.dat" Const SegmentsFile = "C:\Bike Racer\Shared Data\Segments.dat" Const RoadsFile = "C:\Bike Racer\Shared Data\Roads.dat" Const ConfigFile = "C:\Bike Racer\Shared Data\Config.dat" This, of course, means that the programs must always be installed to C: \Bike Racer to run... How would I set them equal to "[Directory Application is Installed In] & "\Shared Data\[?????].dat" Thanks in advance for any assistance, The Confessor Well, Yes I am sure you can have a common module in all the four projects.
Just add that module to your project. For the second problem, use this: - Application.StartupPath Cheers Cyril
Show quote
Hide quote
"Cyril Gupta" <nom***@mail.com> wrote in Thank you, Cyril... my guess had been IO.Directory.GetCurrentDirectory, but news:#Y62GbsFGHA.4036@TK2MSFTNGP12.phx.gbl: > Well, Yes I am sure you can have a common module in all the four > projects. Just add that module to your project. > > For the second problem, use this: - > > Application.StartupPath > > Cheers > Cyril > > I was hoping for something that would allow me to keep declaring them as constants rather than variables (since they *are* constant once declared), but that ain't gonna happen, is it? As for my problem of reproduced code (specifically, declarations)... Well, when I declare my variables in a common module which I've added to each project and subsequently remove the declarations in each specific project, they don't seem to recognized the declarations in the module... Is there any way to tell Visual Basic to basically "Look *here* for more declarations"? The Confessor <inva***@reply.to.group> wrote in
Show quoteHide quote news:Xns974877BC98218invalidreplytogroup@130.81.64.196: Uh, just to preempt any reply...> Thank you, Cyril... my guess had been > IO.Directory.GetCurrentDirectory, but I was hoping for something that > would allow me to keep declaring them as constants rather than > variables (since they *are* constant once declared), but that ain't > gonna happen, is it? > > As for my problem of reproduced code (specifically, declarations)... > > Well, when I declare my variables in a common module which I've added > to each project and subsequently remove the declarations in each > specific project, they don't seem to recognized the declarations in > the module... > > Is there any way to tell Visual Basic to basically "Look *here* for > more declarations"? I'm an idiot. The variables must, of course, be declared as Public in the module to be accessed by the form. Thanks for you help, Cyril. The Confessor <inva***@reply.to.group> wrote in
news:Xns974889F9D8860invalidreplytogroup@130.81.64.196: One further caveat: When you attempt to add the existing module to your > I'm an idiot. > > The variables must, of course, be declared as Public in the module to be > accessed by the form. > > Thanks for you help, Cyril. other projects, you must *link* to it. Otherwise, a copy of the current version of the module will simply be placed in your project's directory, and you'll be left with the same problem as before: modifying four different files instead of one.
Inheritance
Clean up issues What happened to the Class view in VS2005? Drag and Drop to SysTray ? VB 2005 - How to hook into Windows to intercept all mouse events? Hide Window form (top most) Novice Question About Webclient Handling Events in VB.Net A place to discuss future vb featuresause? Menu is disapearing in 2005 |
|||||||||||||||||||||||