Use A Function / Module In 2 Projects
Sep 1, 2009
i started with 1 solution, 1 project a usual. Then i did it again, different project. Then, i wanted to have the 2 projects in 1 solution - so i copyed the project folder from solution 2 into the folder of solution 1 and added as existing project the project 2. So far so good.
Now i have a module with some public functions in project 2, that i want to use in project 1 as well. So i added to the solution a class module (some classes i want to share also) and i moved the module, (that i want to commonly use) into this class library. But it seems wrong - my application does not find the function again.
View 5 Replies
ADVERTISEMENT
Oct 31, 2009
i have a module which i wish to import in several projects. is there anyway i could do this? the current method that i'm using is that i'm copying over several modules in all the projects i'm doing and if i had to change a single module i had to replace that module in all the projects, that is quite troublesome
View 7 Replies
Jan 3, 2012
I would like to know how can I have the same module in many different projects. The trick is that I want to be able to modify that module only in one place and still be used in all the projects.
View 6 Replies
Mar 29, 2010
I have no idea what is going on here but it is strange to say the least.I created a new solution in VS2008Pro under windows 7 This solution has 2 projects one for the pc and one for a CE based device.There is one class module which is shared between the 2 projects.In VS2005 under xp this same basic project worked fine but here I am seeing error messages that appear out of no where.
Example the CE portion flags 3 lines initially 1 related to a file i.o function and 2 others related to socket methods. All three of these were supported in VS2005 using framework 2.0 which is the same framework I am using here. This is just the tip of the ice berg however.If I attempt to run the code it runs fine for the pc client and of course not for the CE device. If I make any kind of change, add a line, comment a line or just add a comment I get lots more errors with odd messages that are not even valid.
In one case after I saved it jumped from 3 errors to 30, in another case to 50 and yet another to 144 errors yet the only errors that were present were the original 3 that were flagged.The ide threw errors like Try Catch must end with matching End Try.Get no longer supported ' apparently referring to the binary file get but here it is used as the get portion of the property.Get must end with matching end get.It also started complaining about functions and data types.For example saying "an is not declared" pointing to the word Boolean Or telling me my functions are not declared point to only 1/2 of the function name.
I do not see any errors in the code and it reports no errors in VS2005 under XP.As a test I tryed adding a new property to the project after it was telling me there were 144 errors. I allowed the ide to do most of the work and when I hit enter the errors went back to 3. Then I saved the project and the errors went to 105 pointing first at the new property just created.
View 5 Replies
Oct 26, 2005
Hi: How can I share the Main Module1 between projects? I have project1 in vb.net and contains Module1 (Sub Main of the application) project2 in C# in project2 I have a form1 class that contains a subroutines that need to reference 6 variables that are declared and instantiated in the project1 in the main Module1. Module1 at present is been compiled as Class Library, plus will be a reference of project2 and because I need this variables referenced from project1 it wont compile of course because they are not declared.
View 2 Replies
Aug 17, 2010
how to close projects or forms than called by ((shell)) function in vb6?
View 1 Replies
Sep 24, 2010
I have an 100 aspx files with one module file for code. All these aspx files have the same backend function, so i created on public module for all these files to access. These files are in the same folder. But for some reason the aspx files cannot access the function from that module.
mod1.vb Code (.vb file)
Public Module Allinone
Sub Allinone_Load(ByRef Page As Web.UI.Page)
[Code]....
I am at a roadblock of why the aspx files wont read this module? Also all these files are in the same directory
View 1 Replies
Sep 29, 2009
I have a console application consisting of two modules. One module named "quote" is the main module for the application. Another module named "common" contains commonly used functions and subroutines that are shared between multiple applications.
In the "common" module is a function named "quote". If I attempt to call the "quote" function from the module named "quote", then I get the following error: Error 1 'quote' is a type and cannot be used as an expression. However, if I copy the quote function from the "common" module to the "quote" module, then I no longer receive this error.
There shouldn't be an issue with calling a function that happens to have the same name as a module, but only when that function is located in a different module.
View 2 Replies
Aug 21, 2011
I have a problem regarding calling the function in form to the module..i have 2 module which is User Login Module and the other Module is Update the Fields of Student..my problem is the Update Module when i call the function in form i cant call the function that i used..this my code in udpate module and this is my code in form The UpdateExeQuery that i use in module.when i call in the form its error..
View 11 Replies
Feb 28, 2012
I've written a series of ASP.NET pages which have several common methods among them. In my ignorance, the best way I was able to find to move those common methods to a separate file was in a Module. However, what I need is a way to identify from which page was the method called?For example, I have a method call WriteToErrorLog with the following signature:WriteToErrorLog(ByVal sender As Page, ByVal Source As String, ByVal Message As String, ByVal StackTrace As String)
View 1 Replies
Jun 11, 2011
I want to Create a Publick Function But Geting problems with last Line
"MyBase.OnKeyUp(e)"
Private Sub _KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Dim dg As DataGridView
Dim txt As TextBox
[code]....
View 3 Replies
Jul 12, 2010
How could I call a module or something else to return data to me after its ran. I don't want to make my form1 code all messy.
Public Function Test() As String
Return "Tes34t"
End Function
[code]....
View 2 Replies
Nov 2, 2009
I have a situation where I have several VB.NET Modules in the same Logical-Module of a large application. I would like the update function of each module to be public, but I would like users to be forced to qualify the function call with the module name.
ModuleName.Update()
instead of
Update()
Is this possible?
View 2 Replies
Jul 13, 2011
I have the following statement and the function 'InitialiseOsTransform' is in a Module which is in the project.
If InitialiseOsTransform() = False Then But instead of the code going into this function it goes into the Paint function.
I have used the similar code in another project and it works correctly.
View 11 Replies
Jul 20, 2009
Im new in this forum. I just recently upgraded my Visual Studio 2003 to Visual Studio 2008.I have a web project which is working very well in Visual Studio 2003. But when Im trying to run the same project in Visual Studio 2008, Im getting a runtime error message.The error message is about a public function which is defined in a public module. When Im trying to call that function from different web pages of my project, the web pages are not recognising the public functions and asking me to
View 3 Replies
May 25, 2012
I have an application (app.exe) that has a VB Module in its source code (Module1). The module has a function called Function1. I need to call this function from another application. The module is not marked as public, so adding a reference to app.exe won't work. I'm trying to use reflection (Assembly.LoadFrom()) but unless I'm way off base, the module would have to be a class in order for me to get an instance of it.
Please nobody ask me "what have you tried?" I tried a million different things and let's just say "none of them work." So I'm looking for someone that has specific experience with doing exactly what I'm trying to do. If you don't have that experience, please move on to the next question and ignore mine.
View 1 Replies
May 28, 2009
I did following on panel paint and it works great. I want to make a function in module and send panel to it and do the following color stuff on it. how i can do it?
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Dim brush As New System.Drawing.Drawing2D.LinearGradientBrush(e.ClipRectangle, Color.White, SystemColors.Control, Drawing2D.LinearGradientMode.Vertical) '(Me.ClientRectangle, Color.Blue, Color.White, Me.Horizontal)
[Code]...
View 1 Replies
Apr 19, 2010
I have written the following Sub in moduleFunctions to call in any form. But it gives an error: "Name 'txtVNO' is not declared" & "Name 'txtVNM' is not declared"
Public Sub txt_Clear()
txtVNO.Text = ""
txtVNM.Text = ""
End Sub
View 6 Replies
May 20, 2009
I wand to Expose a function inside a module in my Class Liberary( DLL)
module Module1
Public Function Add(val1 , val2) as double
return val1 + val2
End Function
End Module
View 7 Replies
Apr 5, 2010
I am using VB2008 In the Form1, i have coded
Public Function getText(ByRef ctlName As String) As String
getText = Mfg.get_TextMatrix(Mfg.Row,Mfg.Col
[Code]...
View 5 Replies
Nov 5, 2010
I failed at the title: it should be "access a function of a class from a module"Edit by Moderator: I've amended the title for you.I got a huge VBA program which opns an excel workbook.I want that if i press crtl + s excel dont calls his save function but my own written save-function.
The code looks like this:
Code:
Namespace Test
[code]......
View 8 Replies
Mar 7, 2012
I have a single form application with two modules. The first module holds all the Sub procedures that provide the filtering functionality for 3 DataGridViews on the form. The second module holds the Predicate of T functions that actually filter the List(Of T) objects that are bound to the DataGridView controls.
I split them into modules since I was starting to have difficulty organising and finding the procedures and functions if I held them all in the form code.In some cases I can happily both Get and Set form control properties from within the modules. In one case I simply can't, I suspect I may yet find some more instances as I test further. The offending line is in one of the Predicate of T functions:
If tWord.Length <= Investigator.NumericUpDown.Value Then Investigator is the Class name of the form.
I suspect my problem might be that the Predicate of T functions (which are collated in a module) are called from the DoWork procedure of a BackgroundWorker that is a component of the form - hence the DoWork procedure is in the form code, but I'm not certain. The same code worked fine when everything was all in the form code. The error reported when adding a watch to the Value property in the module function is "
'Value' is not declared. It may be inaccessible due to its protection level ". I have tried the following to no avail:
1) Setting the NumerciUpDown modifier to Public
2) Adding a Public ReadOnly Property to the form class that simply returns the Value propety of the NumericUpDown
3) Adding Imports Root Namespace.Investigator to the module
I am considering adding a Public Shared variable to hold the curent value of the NumericUpDown and referencing that from the Predicate of T function.I realise, and have read many times, that accessing form control properties from module functions is generally not seen as a smart thing to be doing, but since I am not trying to chnage anything, I simply want to know what the current value is I decided that I wasn't too worried.
View 11 Replies
Mar 2, 2011
I have a function in a module that returns a datatable.I need to call that function asynchronously and get the results in the Main thread (Main Form) in vb.net.
View 2 Replies
Jan 28, 2010
I have a form set up where I want to run the function PopulateGrid on it's Form_Load event. I have initialized the DB connection as follows:
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadConfigFile()
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & config("DatabasePath") & ";")
cn.Open()
End Sub
Now, I want to run the PopulateGrid function directly after I connect to the database as shown above. I'm confused as to how I'd use a database query in a module when the database is initialized in my main form. Would simple setting the variable cn to public work?
View 1 Replies
May 13, 2009
I have a module1.vb that contains a public sub, for example
Public Sub LogEvent(ByVal strIn As String)
Dim objLogFile As Object
objLogFile = frmEventLog.txtLog
[code].....
View 15 Replies
Mar 13, 2011
I have to calculate y = a + Bx or y = mx + b in non engineering form. Anyways I have to calculate the y intercept first and am having trouble calling the function from a module. Here is the module and the second window will be the code from my main form
[code]...
View 8 Replies
Mar 15, 2009
Removing projects from VB2008 start page recent projects list. The above list is getting clogged. How do I remove items from this list?
View 3 Replies
Feb 4, 2012
i just got 1 question how do u create a (in excel ) variable table (database) inside a function which could be called for filling and reading through "for to next" loop module
View 2 Replies
Aug 16, 2010
how we can declare a connectionstring in a module and call that module
View 1 Replies
Apr 27, 2012
I have a VB.Net interface that communicates with an Access 2k3 Database using this module:
Module MOD_ENGINE
'Declare Database connections controls
Dim con As New OleDb.OleDbConnection
Dim dbProvider, dbSource As String
[code]....
I want to call EngineConnect procedure from MOD_ENGINE module into popCboBox module so I can ignate the engine!
View 3 Replies