473,569 Members | 2,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to call code in aspx webform from functions defined in code behind modules

CW
I find it necessary to mix code-behind and non-code behind techniques
sometimes.

I have utility functions defined in a VB module. Is there anyway for me to
call functions defined in VB module from aspx form (i.e., code mixed in with
html elements) or even call public shared functions from other code behind
classes)?
Nov 18 '05 #1
3 3726
<%=FunctionName %> in the HTML will call your code-behind function, which
must be defined as Protected.

"CW" <a> wrote in message news:OU******** ******@TK2MSFTN GP12.phx.gbl...
I find it necessary to mix code-behind and non-code behind techniques
sometimes.

I have utility functions defined in a VB module. Is there anyway for me to
call functions defined in VB module from aspx form (i.e., code mixed in with html elements) or even call public shared functions from other code behind
classes)?

Nov 18 '05 #2
CW
Thanks for the help

"Rick Spiewak" <ri*********@mi ndspring.com> wrote in message
news:O2******** *****@TK2MSFTNG P09.phx.gbl...
<%=FunctionName %> in the HTML will call your code-behind function, which
must be defined as Protected.

"CW" <a> wrote in message news:OU******** ******@TK2MSFTN GP12.phx.gbl...
I find it necessary to mix code-behind and non-code behind techniques
sometimes.

I have utility functions defined in a VB module. Is there anyway for me to call functions defined in VB module from aspx form (i.e., code mixed in

with
html elements) or even call public shared functions from other code behind classes)?


Nov 18 '05 #3
You can access code from code modules, however you must declare the
Module Public and you must qualify the call with the proper namespace.
For example:

in you module:

Public Module Module1
Public Function getString() As String
Return "from module"
End Function
End Module

in your call:

<%=VBTest.Modul e1.getString()% >

where VBTest is the name of the project or parent namespace of
Module1.

hope this helps,

John
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
5883
by: Tim ffitch | last post by:
Hi I have created a VB dll file that contains common functions I use across various projects in VB, Access and Excel. Rather than have to code the functions in each I decided to use the dll route. The problem being that I can't call these functions from the query designer in Access. I decided that I would try the route of declaring the...
2
13721
by: adiel | last post by:
Hello, I am trying to access the properties and methods from a user control within the code-behind file for a webform but I am receiving the message: Name 'MenuBar1' is not declared It does not recognize the user control in the code behind... Here is the code for the user control: MenuBar.ascx:
1
1314
by: timmso | last post by:
If I create a webform in notepad (save it with an .aspx extension), I can see the VB.Net code along with the ASP.Net code in one file. If I create an Asp.Net web application and add a web form using VS.Net, only the Asp.Net code is behind the web form. Where is the VB.Net code stored? And why is it stored differently than the first way I...
2
1670
by: Technical Support | last post by:
Good afternoon, I created a custom control, compiled it into a DLL, and added it to the BIN directory. I placed an instance of the control in a webForm and am trying to programatically change its properties via the Page_Load subroutine in a code-behind file. Can someone please tell me the proper procedure for declaring the new custom control...
6
12265
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I would like to do this by defining a NewFunc() that is different in each (code-behind) page which is called by the standard 'New' button in the...
171
7645
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles) like it because you can split the code from the design. That is logical. But if you are the only one working on the code, it seem a little...
4
3403
by: qualitynice | last post by:
HELP :-)... I'm creating an embedded activex object in an asp.net page using the HtmlGenericControl class. I'm doing this because when I tried to embed it directly in the aspx page, it stopped working once I changed it to run on the server (runat="server"). It said the GUID was wrong. I found code showing how to implement an activex...
4
3485
by: Michael | last post by:
Hi When I New a web site, the default coding model is code-separation. I can uncheck the "place code in separate file" checkbox when I add a new WebForm, and VS2005 will remember this setting. I'm wondering where does VS2005 store the settings for "place code in separate file"?
11
6612
by: Yelena Varshal via AccessMonster.com | last post by:
Hello, I have a problem with one of msaccess.exe API calls that work on my desctop but does not work on the laptop from within MS ACCESS. There is a lot of differences between 2 computers including one running Office 2000 and another running Office 2003. This code was created by a previous developer. I need to find the description and...
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.