Calling A Function From Another Module?

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


ADVERTISEMENT

Calling Function With Same Name As Module?

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

Calling A Function That's In A Module In External Application

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

IDE :: How To Calling Form Object Public Function From A Module

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

VS 2008 Calling Function Inside A Module -> InvalidOperationException Occurred?

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

Asp.net - Calling A Shared Procedure From A Module?

Aug 6, 2011

I would love to use the following procedure to set the Title, keywords etc. of my pages, in a module.

Public Shared Sub SetTitle(ByVal Heading As String, ByVal Keywords As String())
Dim myMaster As Masterpage = DirectCast(Me.Master, Masterpage)
If Request.QueryString("lng") = "es" Then

[Code]....

The problem is that i get two errors.

At Me.Master i get the 'Me' is valid only within an instance method. error and at

If Request... i get the error

Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

So how do i fix these? I would like to have that procedure in a common place and not in every page.

View 1 Replies

Calling A Webpage From Within A Class Module?

Jun 1, 2009

I have been given an ASP.Net assignment at work because I had taken a few courses a couple of years ago. Currently, there are no ASP.Net programmers for me to ask here and I have searched several places (including Pro ASP Net book) to find a solution but have come up empty handed.

I have a class named spErrors which takes the values passed to it. Values passed include the offending page,function/sub, and other values and stores them in property values, then calls Response.Redirect("Errors.aspx") from the page's code behind page. In Errors.aspx, the values of the error/exception trapped in the Catch statement are displayed. This works fine from a web form. My question is, how do I call a web page from a class module?

Each class module has the ErrorHandler() procedure that passes these values to the class object. In the class, there is a Write Only property named Redirect and a method called Execute() which is used to display the error page if the error occurs in another class module. Since Response.Redirect() does not work in a class module, what namespace is needed in order for this to work?

Here is the code I'm using.

In the Catch block.
Catch ex As Exception
Err.Description = ex.Message
ErrorHandler(Err, "function name")

[code]....

View 2 Replies

Calling Module When Textbox Focus

Dec 15, 2011

I am developing a VB net application with lots of TextBox. I need to call a module everytime any of the textbox gets focus. I dont want to write code in every textbox gotfocus event, but a generic code which will call the module everytime any textbox gets focus.

View 6 Replies

VS 02/03 Calling A Form's Controls From A Module

Jun 10, 2011

I'm writing a program in vb.net 2003 and have come up with a problem.

I have a sub SettingsSave() in a module.

Public Sub SettingsSave()
Dim frmSaveSettings As New frmSettings
MsgBox frmSaveSettings.txtName.Value 'for testing purposes
SaveSetting("MyApp", "configs", "Name",frmSaveSettings.txtName.Value)
SaveSetting("MyApp", "configs", "Pass",frmSaveSettings.txtPass.Value)
End Sub

I have a form frmSettings, which has a button btnSave. When the button is clicked, SettingsSave() is called.The problem is, if btnSave is clicked, then either of the two textbox values are changed, then btnSave is clicked again, the SettingsSave() sub still returns the 'old' values (from the first time the save button was clicked).How do I clear the old values from memory? I've tried adding frmSaveSettings = Nothing, and frmSaveSettings.Close at the end of the sub SettingsSave().

View 5 Replies

VS 2008 Calling Form Controls From Module?

Aug 25, 2009

I have a Sub Routine in a module to iterate controls on a form. I get an error about an instance of the object not created.I have declared the object and set it to the form (ModelsBox = Me). I have done this between two forms previously. Is there something fundamental that I am missing. Is this where the "Friend Shared" comes into play?

[Code]...

View 2 Replies

Setting A Variable To Accept The Result Of A Function By Calling The Function With Many Parameters

Feb 17, 2011

I'm currently working with a client's VB.Net code, which was developed for them by a small development shop a few years ago and which they purchased and have been maintaining and uprgrading since. This client's primary developer is out on indefinite (likely permanent) medical leave and I'm now filling in until they bring in a full timer (as I'm a contractor here). My current task is to add some functionality to a the VB.Net code they purchased. I'm finding practices and techniques in the code that absolutely baffle me and can't make the code do what I want. I'm starting to wonder if it's me and was hoping to get some thoughts on the code I've encountered.

For example: Setting a variable to accept the result of a function by calling the function with many parameters, clearing the parameters in the function, setting them to some value, calling another function with those new values, then never using the values returned by the functions. I'll add a code snippet in the first comment since this is already getting long.

View 9 Replies

Threaded Function Call Slower Than Calling Function Directly?

Sep 14, 2010

I have a function where I am performing a lot number of database operations inside a Sub. The operation when called directly like:ExecProcess()

takes about 11 seconds to run.However, if I create a Delegate, and call the sub using BeginInvoke(), the very same process takes over 40 seconds to execute.Here's the threaded code:

Protected del As ProcessDelegate
Protected Delegate Sub ProcessDelegate()
del = New ProcessDelegate(AddressOf SELocal.ExecJob)
Dim cb As New AsyncCallback(AddressOf Me.ExecJobComplete)
del.BeginInvoke(cb, del)

Anyone know what may cause a function to take longer inside a new thread, rather than calling directly?

View 2 Replies

VS 2010 - Calling A Function - BackOrdered Function Of Program

Mar 30, 2012

I am having a problem with the BackOrdered Function of my program. I can`t get it to say anything but 0 when I run the program. Another problem I am having is the input box pops up like 6 times and it`s only suppose to once. [Code]

View 9 Replies

Cannot Call The Function In Module

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

How To Get The Module.Function Caller

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

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

Creating A Publick Function In Module?

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

Module Returning Data Like A Function?

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

Update Function Of Each Module To Be Public

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

VS 2008 Function In Module Is Not Being Called

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

Call Public Function In Module From WebPage?

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

Make A Function In Module And Send Panel?

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

Error In Module While Writing Function - Name 'txtVNM' Is Not Declared?

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

Expose A Function Inside A Module In Class Liberary( DLL)

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

Office Automation :: To Access A Function Of A Class From A Module?

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

Refering To A Form Control Property From A Module Function / Sub?

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

Calling A C DLL Function?

Oct 3, 2011

I have used the PInvoke Signature Toolkit to create VB.NET function definitions for three fairly simple C functions contained in an external DLL. The problem is that two of the parameters are structures so pointers need to be sent and one structure (fileview) is undefined.

OpenFileView(filename, &fileview_ptr)
ReadFileInfo(fileview_ptr, &fileinfo_ptr)

The structure of fileinfo is defined so I can create a structure definition in VB.NET and create an IntPtr to that structure with Marshall.AllocHGlobal. And then I can use Marshall.StructureToPtr to copy the data and do the inverse when the data is returned.

[Code]...

View 1 Replies

Calling A C Function From A DLL?

Dec 7, 2009

I'm having some problems calling a C function from a DLL. The function is returning -101 which translates as a "bad parameter". The values I am passing have been returned from another, successful function call, so my current assumption is that I've built the structure incorrectly.The function definition is:

int sm_switch_channel_input(struct sm_switch_channel_parms *switchp)
Parameters
*switchp (a structure of the following type):
typedef struct sm_switch_channel_parms {

[code].....

View 2 Replies

Calling A Function In A DLL?

Mar 18, 2009

in a DLL that takes a pointer to a structure as a parameter.The C and VB code is as follows.Am I passing the structure in calling the DLL correctly? I am asking because the API call returns a valid error code indicating error opening the com port specified. I tried all valid ports (com1 on a Vista 32 machine with a USB-Serial device and com1 defined in device mgr, com1 and com2 on a desktop with winxp and 2 real serial ports).I dont have the code for the DLL and cannot debug into the DLL code.

C code
typedef struct _SETUPPR {
CHAR Port[5];

[code].....

View 1 Replies

Calling A Function Like A Sub?

Mar 15, 2011

I'm sure this is a pretty simple question but I can't seem to find the answer on Google. Say I've got a function that does some stuff and returns a string. I can assign its return value to a variable:

Dim result As String = MyFunction()

But sometimes I want to perform the actions within the function but I don't care about the return value. I know I can simply call the function from code.

Sub Main()
' Code
MyFunction()
' More Code
End Sub

This works and does exactly what I need it to. My question is - are there any issues or pitfalls in doing this? Particularly I want to make sure I'm not introducing any performance or memory leak issues.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved