473,473 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Subroutines in a Form

I have a form with thirty text boxes.
Each of them has an input mask of 99.

In each text box the user enters a numeric score in the range from 0 to 99.

As each text box loses focus I want to perform a calculation involving all
the numbers (ok the string representation of the numbers) . It doesn't
matter which text box loses focus, the calculation is the same.

Can I declare (define) a subroutine (Procedure ?) and call it from the lost
focus event of each text box .

I suspect I can but when I looked for details I couldn't find any.

Thanks
Jul 10 '06 #1
2 1826
On Mon, 10 Jul 2006 23:42:38 GMT, "RICHARD BROMBERG" <no*****@att.netwrote:
>I have a form with thirty text boxes.
Each of them has an input mask of 99.

In each text box the user enters a numeric score in the range from 0 to 99.

As each text box loses focus I want to perform a calculation involving all
the numbers (ok the string representation of the numbers) . It doesn't
matter which text box loses focus, the calculation is the same.

Can I declare (define) a subroutine (Procedure ?) and call it from the lost
focus event of each text box .

I suspect I can but when I looked for details I couldn't find any.

Thanks
In the form's module create a FUNCTION.

'================================================= ======
Function fDoCalc()

'write your routine here to do whatever calculations you require.

Me.txtResult = Me.txt1 + Me.txt2 + Me.txt3

End Function
'================================================= ======

In the property sheet of the form, select each of your 30 text boxes and in the
LostFocus event put -
=fDoCalc()

The function will be triggered each time any of the text boxes loses the focus.
Wayne Gillespie
Gosford NSW Australia
Jul 11 '06 #2
Hi,

Perhaps it's more efficient to run this function at the AfterUpdate
event, thus after editing. (Unless you use VB-code to fill the text
boxes)

HBInc.
Wayne Gillespie wrote:
On Mon, 10 Jul 2006 23:42:38 GMT, "RICHARD BROMBERG" <no*****@att.netwrote:
I have a form with thirty text boxes.
Each of them has an input mask of 99.

In each text box the user enters a numeric score in the range from 0 to 99.

As each text box loses focus I want to perform a calculation involving all
the numbers (ok the string representation of the numbers) . It doesn't
matter which text box loses focus, the calculation is the same.

Can I declare (define) a subroutine (Procedure ?) and call it from the lost
focus event of each text box .

I suspect I can but when I looked for details I couldn't find any.

Thanks

In the form's module create a FUNCTION.

'================================================= ======
Function fDoCalc()

'write your routine here to do whatever calculations you require.

Me.txtResult = Me.txt1 + Me.txt2 + Me.txt3

End Function
'================================================= ======

In the property sheet of the form, select each of your 30 text boxes and in the
LostFocus event put -
=fDoCalc()

The function will be triggered each time any of the text boxes loses the focus.
Wayne Gillespie
Gosford NSW Australia
Jul 11 '06 #3

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

Similar topics

4
by: Fred | last post by:
I have read and tried every combination for hours. I'm sorry, but I don't get it. How do I have a form with textboxes and buttons and allow click events to execute a server function then display...
3
by: joe | last post by:
Hello: I am using IIS 5.0, ASP and VBScript. I am puzzled by recurrences of errors when I nest subroutines, and I'd like to know if there are rules for that which I don't know. Would functions...
22
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to...
7
by: Microsoft | last post by:
I'm not sure where to physically place my subroutines in vb.net I get namespace and not declared errors... Imports System Imports System.Management Public Class Form1
5
by: OpticTygre | last post by:
Heheh...I've got lots of questions today. If I have a loop that calls the same subroutine several times (that subroutine may be processor and network intensive): For i = 1 to 100 Call...
3
by: OpticTygre | last post by:
I have a class, ProcessFiles, with several subroutines it runs for each type of file I want to "process." First, I check directories for files. Then, based on the filenames of those I find in...
11
by: isoquin | last post by:
Really, i've looked for the answer, but I must be missing some syntax somewhere... I have a popup calendar which is to be used across several forms. Each form will need the calendar to...
7
by: mirandacascade | last post by:
Note: I'm not sure if the subject line of this post uses the correct terminology, so apologies if the subject line turns out to be misleading. I think it's probably easier to provide a trivial...
10
by: liz0001 | last post by:
Hi, I need to access an .asp subroutine file from a subdomain. i.e. the website is at www.domain.com and I want to access the same subroutines on the subdomain mobile.domain.com. The...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.