473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How do I autoCalculate in VB2008 without using a Button

Arevin
5
Hey all, I'm working on a VB program that is a cashout sheet. In this sheet, there are about 23 fields where information is being input. What I am trying to do is create the program so that when the user presses tab, enter or down arrow key it goes to the next field in the tabindex and then continues to add all the fields that are associated with each of the totals textboxes.

I know that this can be done with with a button, but I don't want the user to have to click the button everytime they want to update the total field.

For example, my deposits' Totals field has the following code, am I way out in left field in thinking that this can be done "on the fly"?:
Expand|Select|Wrap|Line Numbers
  1. Private Sub TotalsTextBox_Cursorchange(ByVal sender As Object, ByVal e As System.EventArgs) Handles TotalsTextBox.CursorChanged
  2.         Dim num1, num2, num3, num4, num5, num6, num7, num8, TotalDeposit As Decimal
  3.         num1 = Val(BDepositTextBox.Text)
  4.         num2 = Val(ChargeTextBox.Text)
  5.         num3 = Val(DebitTextBox.Text)
  6.         num4 = Val(CreditTextBox.Text)
  7.         num5 = Val(CouponsTextBox.Text)
  8.         num6 = Val(CertificatesTextBox.Text)
  9.         num7 = Val(Received_On_AccountTextBox.Text)
  10.         num8 = Val(DErrorTextBox.Text)
  11.         TotalDeposit = num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8
  12.         TotalsTextBox.Text = Val(TotalDeposit)
  13.     End Sub
Sep 24 '10 #1
2 3197
Guido Geurs
767 Expert 512MB
in VB6 You can use the CHANGE procedure like: 3 textboxes , enter a value in Text1 and Text2 and each time the value changes in one of them then Text3 gives immediately the result

Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_Change()
  2. Text3 = Val(Text1) + Val(Text2)
  3. End Sub
  4.  
  5. Private Sub Text2_Change()
  6. Text3 = Val(Text1) + Val(Text2)
  7. End Sub
Sep 24 '10 #2
Arevin
5
Unfortunately, this does not work for me. I'm using VB2008 Express. Sorry if I am in the wrong forum. It's been a LONG time since I used VB. Anyway, I've also tried to do this in Access 2010, but the problem that i've come across there is that I have a field in one table that compares a field in its table to another field in a different table and access doesn't like that either :S.
Sep 27 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: wallster | last post by:
please keep the flaming to a minimum (a bucket of water is next to me) but I have a question someone here might be able to explain in basic terms for a dunce like me. I helped a friend put...
7
by: mg | last post by:
I need to first open WebForm2 from WebForm1 and then close WebForm1 without the end user having to press an OK button before the close can occur. For example, possibly ...
5
by: Wonder | last post by:
How can I create or use the msgobx to show a message without a default button. The user has explicity to click on the button, so the msgbox closes it. Thanks,
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
10
by: Frankie | last post by:
I am looking for tutorials, articles, etc that can help to enlighten me on what's "really going on" or what's required to create a .NET application (particularly Windows Forms) WITHOUT the use of...
1
by: jatrojoomla | last post by:
Hi, I am New in JS world, I want's to submit a from using JavaScript ? is it possible? if yes then how? how to impliment document.form.submit? plz help me.
2
by: rodwilnot | last post by:
This is a very basic question. I've searched around a bunch on groups, the web, etc., and found tons of information but nothing that specifically answers my question. My suspicion is that I am so...
3
by: JimO | last post by:
Is there a way to force a post without using submit button? Thanks, Jim
9
by: NUPUL | last post by:
Hi, The Qt toolkit claims to be completely written in C++. What I would like to know is how do I draw a window with a button (or any widget for that matter) using C++, without using the Qt...
2
by: sasimca007 | last post by:
Hello friends, I have a doubt, that without using the events how do we know the button was clicked or not in javascript
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.