Solved

conversion from vb6 (ide) to vb.net(IDE) - specific qustion on use the "common utility".vb

Posted on 2014-01-06
17
310 Views
Last Modified: 2014-09-15
I have a specific question on how to structure the vb.net program.

In our situations, many of our applications that written in vb6, have a common utility section of the code that contains all the common functions, and subroutines.   These functinos and subtoutine/methods are used by our various applications.

I know in vb.net, there is a way to put all this common utility in a places say called "common_utility.vb", and can be referedor called by every program.  either from debugging purpose or compiled exe versions.   This is very similiar to "%include source_code_path"  in other procedures language, such as PL1.

Is there anyway, we can have the similar way to structure of our current vb6 source code in this fashion?  so the vb6 -> vb.net wizard can convert the vb6 to vb.net in a more clean and easy way?

ps.  we have good reason not to use DLL for this cases.

thank you for your help
0
Comment
Question by:mshox1
  • 5
  • 4
  • 2
  • +1
17 Comments
 

Author Comment

by:mshox1
ID: 40206760
why there is NO one give any attention to this qustions?
it has been over 7 month from the time I request.

is the statement like following

imports common_utility.vb

works?


Please response

thank you
7-19-2014
0
 
LVL 4

Expert Comment

by:Chris Watson
ID: 40216980
The standard for this would be to place the code you want to share in a separate assembly and reference it from the assemblies you wish to consume the shared functionality. However, as you've already ruled this out, there's nothing stopping you linking the same file to multiple projects in a solution. If the projects in which you wish to consume the shared functionality are not in the same solution perhaps you could achieve the same effect by way of svn:external properties (or whatever equivalent is offered by whichever version control system you are using).
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40217008
In each project that needs to use common_utility.vb, do the following, starting in the Project menu:

Add Existing Item...
Navigate to the directory that contains common_utility.vb, and select it, do not double click.
Instead of clicking normally on the Add button, open it with the little triangle at the right side of the button.
Select Add As Link

All the projects will now link to that single source code file. Make a change in the file and all the projects will get it.

This being said, what is the good reason not to use a dll? They are most of the time a better solution.
0
 

Author Comment

by:mshox1
ID: 40217129
I like add as Link ideal.  I will give it a try to make sure it works the way I antifipate.

to answer your questions why not use dll.   the reason I do not want to use dll is that in our situations, we frequently need to use "debug" mode to execute some simple or temp change modifications.  -- we even not save the changes.   use "link", then we can step through the "common.vb" code to control the process.   if we use dll approach, we need to be engage a formal change control process...  this is just a trade off between 2 approach that best suite our working enviorments.

I will close the solutions after I get a chance to experiement/verify your approach.  thanks again
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40217190
In .NET, you can step through the dll code when you debug the application.

Simply build your projects as a solution.

Open one of your application projects and File...Add...Existing project. Go to the code source of your dll and click Open. Your Solution Explorer now have both your application and your dll.

If you reference the dll as you usually do, the reference is to the compiled dll, and you won't be able to step through the dll, so you must set your reference to the source code instead of the dll. To do that, once you are in the References window, go into the Projects or Solution tab (depending on your version of Visual Studio), and reference your dll from there.

The source code of the application is linked with the source code of the dll. While debugging, when you go step by step in the application and you encounter a call to the dll, the debugger will step into the source code of the dll.
0
 

Author Comment

by:mshox1
ID: 40217237
thank your addtional experts comments of vb.net can debug and step throught the DLL.  I will give addtional considerations.

Lets discuss further of "add as link" to the project.  is there a similar way in vb6?   I like to start from VB6. set the common_utility.bas as the link to my project.   I will then use that as the base to apply the converstion wizard provided by 2008 vb express.   any new program after my converstion done, will for sure use "add as link" method to construct the source code.

Please advise
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40217303
In VB6, the equivalent of Add As Link is the default when you add an existing item to a project. So you have it automatically. But it does not show the little arrow indicating a link, so it is prone to errors, because programmers who work in a project do not know that the same file is shared between different projects.

I do not know how the converter will behave with that however.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40292197
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
 
LVL 4

Expert Comment

by:Chris Watson
ID: 40292198
There's plenty of pertinent information here, especially from James Burger. I don't agree with this question being deleted.
0
 
LVL 40
ID: 40292552
I agree with Chris Watson.
0
 

Author Comment

by:mshox1
ID: 40307561
agree, this solutions have plenty of information.  consider solved.  thank you
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40307567
How did I wind up with the points? I definitely shouldn't get them.
0
 

Author Comment

by:mshox1
ID: 40307568
sorry for my late response.  I consider this solution closed.  I would like give Mr. Berger full credit for his solutions.  thanks
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
.Net application crashing 6 21
Recommendation vb6 to vb.net or others 14 39
Close word object 13 18
Open a word document 23 13
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now