How to add a file reference to VB project

Greetings,

I have a VB project that contains about 20 vb files.  Each file handles a particular function like importing a file, or changing an asset location etc, etc.

I'm adding another file to perform a function that closely relates an existing file/function.  How do I make reference to this file so I can use a particular routine in that file?

Considering the picture below, I would expect a dropdown somewhere that would provide a way to reference project files.

How would I do this if the file name I need to reference is called AssetChangeDept.vb ??

Thanks!
adding-reference-example.JPG
John500Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silemoneCommented:
In solutions Explorer pane,

right click and Add Reference...
Most likely go to Browse and get the .exe or dll...but .vb file isn't compiled, so that's not going to work...if you want to use the vb file, then you could

In solutions Explorer pane,

right click and add existing Item...
0
John500Author Commented:
Sorry if I wasn't clear on the project configuration.  The twenty files I spoke of are part of the existing project.  Thus, the file I'm adding will be file 21 and let's say the file I want to barrow from is file 5.

Since this file 21 handles a completely separate task I don't want to add the code to file 5.  I just want to make reference to the routine in file 5.

See what I mean?
0
silemoneCommented:
I think i understand what you want...will you need runtime values from file example file 5?  Meaning will it be running live data and when you access it, the success of file 21 is dependent upon that data?  or will you be passing the values to file 5 from file 21?  if so, could you just create an instance of form 5 within form 21 (OOP) to use its methods?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

WilliamCommented:
Can you use inheritance?

If you use this the new class(file) will have all the functionality of the original file...
Public Class ClassA 
    Inherits ClassB 
    Public Sub FunctionExtension() 
        Me.ClassBFunction() 
    End Sub 
End Class 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WilliamCommented:
I may have misunderstood ...
This file - AssetChangeDept.vb  - Does it contain a namespace?
If so you need to :

Imports AssetChangeDeptNameSpace.FileNameClassName

Does this make sense or ???
0
John500Author Commented:
I won't be needing any runtime values.  I just need to access the methods or functions from file - AssetChangeDept.vb

File AssetChangeDept.vb definitely contains a class called 'AssetChangeDept'

This class has a particular function I want to use - Private Sub MoveAsset()

The constructor for the class looks like this:

Public Sub New(ByVal f1 As AssetTrack)
        Call InitializeComponent()
        form1 = f1
End Sub

I guess I need to declare an instance of the class in my new file.  However, I don't need or want the Form that comes with this class.  I guess I have two choices at this point:

1)  Create an overloaded constructor that doesn't take a Form  (how would that look? )
2)  Be redundant and forget this class - just barrow all the code in the new file.

If I did create a new constructor, how would I do it?  The call to InitializeComponent() basically initializes all the buttons and objects of a Form I'm not even using:

Public Sub New()
               ????????
End Sub

Then what in my new file?

Thanks






0
silemoneCommented:
well if that's the case, what you can do is create a helper class and pull out this functionality and place it in a regular class...and create an instance of the helper class to take care of this method...then you can delete if from the .vb also and create an instance of helper class in there as well to access the method...
0
John500Author Commented:
I ended up going an entirely different route which relied more on the database stored procedures than the VB code.  Take a look at this question if you folks get a chance:

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23918454.html
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.