473,388 Members | 1,600 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,388 software developers and data experts.

Using Simultaneously Changing Textboxes

Hello Dear All,

I have 3 textboxes that values are dependent on each other like:

textbox1.value= textbox2.value+textbox3.value.

When I change the value in any of the textbox and press the command button:

I want the values to equate each other. I did this, but of course did not work.

P = TextBox34.Value
T = TextBox35.Value
N = TextBox33.Value

N = P * 60 * 1000 / 2 / PI / T
P = N / 60 / 1000 * 2 * PI * T
T = P * 60 * 1000 / 2 / PI / N

TextBox34.Value = P
TextBox35.Value = T
TextBox33.Value = N

I know that I can change 1&2 textbox values at the same time.
Dec 15 '11 #1
6 1774
Guido Geurs
767 Expert 512MB
Use different var's for the calculations because it's confusing now !
What are the new values and what are the old??

something like:

Expand|Select|Wrap|Line Numbers
  1. Pold = TextBox34.Value
  2. Told = TextBox35.Value
  3. Nold = TextBox33.Value
  4.  
  5. Nnew = Pold * 60 * 1000 / 2 / PI / Told
  6. Pnew = Nold / 60 / 1000 * 2 * PI * Told
  7. Tnew = Pold * 60 * 1000 / 2 / PI / Nold
  8.  
  9. TextBox34.Value = Pnew
  10. TextBox35.Value = Tnew
  11. TextBox33.Value = Nnew
Or if you want to use the new values like:

Expand|Select|Wrap|Line Numbers
  1. Nnew = Pold * 60 * 1000 / 2 / PI / Told
  2. Pnew = Nnew / 60 / 1000 * 2 * PI * Told
  3. Tnew = Pnew * 60 * 1000 / 2 / PI / Nnew
Dec 15 '11 #2
Thank you!!

But when I do it, textbox value displayed in userform is 1001.2 for example.

But code inside VBA understands it as 10012.

So my results are incorrect.

How can I correct it?

Thanksa,
Dec 15 '11 #3
Guido Geurs
767 Expert 512MB
did you dimention the var's as DOUBLE ?
this is working in Excel 2003:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandButton1_Click()
  2. Dim Pold As Double
  3. Dim Told As Double
  4. Dim Nold As Double
  5. Dim Nnew As Double
  6. Dim Pnew As Double
  7. Dim Tnew As Double
  8. Dim Pi As Double
  9.  
  10. Pi = 3.14159265358979
  11.  
  12. Pold = TextBox34.Value
  13. Told = TextBox35.Value
  14. Nold = TextBox33.Value
  15.  
  16. Nnew = Pold * 60 * 1000 / 2 / Pi / Told
  17. Pnew = Nold / 60 / 1000 * 2 * Pi * Told
  18. Tnew = Pold * 60 * 1000 / 2 / Pi / Nold
  19.  
  20. TextBox34.Value = Pnew
  21. TextBox35.Value = Tnew
  22. TextBox33.Value = Nnew
  23.  
  24. Range("A1") = Nnew
  25. Range("A2") = Pnew
  26. Range("A3") = Tnew
  27. End Sub
Dec 15 '11 #4
yes! i did totally the same.

Do you know any method that I can make . and , as the same inside the code?

I mean 1.1 is 11/10 and as same as 1,1
Dec 15 '11 #5
Private Sub UserForm_Click()
Application.DecimalSeparator = "."
Application.ThousandsSeparator = "."
Application.UseSystemSeparators = False
End Sub
Dec 15 '11 #6
Guido Geurs
767 Expert 512MB
There are different things to take in consideration when you work with textboxes:
- when the text in the textbox has not the format of the settings in the workbook (options - international - number settings): the transfer is a text and not a value (but you can calculate with the cell : the TRANSFER is text= right alignment).
- the settings in the workbook can be different with the general "international" settings in Windows.
- when the transfer is done as text, you have to format the cells with custom settings like "#.##0,0".
Attached is a form for tests with differed settings
Attached Files
File Type: zip using simultaneously changing textboxes_v1.zip (10.9 KB, 41 views)
Dec 15 '11 #7

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

Similar topics

3
by: spribob | last post by:
why does the \t (tab character) not work in a textbox or listbox, but does work in a MessageBox? Example: string strText = "ABCD\tEFG"; textBox1.Text = strText; the above displays as a black...
0
by: Nathan Sokalski | last post by:
I am making a webform that allows the user to add another textbox by clicking a button to allow them to enter however many names they need. The procedure that does this uses information entered in...
20
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the...
2
by: tricard | last post by:
Hello all, I have a report that displays four pieces of data by default, but two of these fields are not neccessary for all people to see. I have made a form that gives the user the choice to...
9
spider1916
by: spider1916 | last post by:
I am using the common dialog control to allow my users to select any printer available to them. The code I am using keeps changing the selected printer to the default printer............I don't...
4
by: anandhk75 | last post by:
Hi, I am New is MS integration services 2005 i am using Slowly Changing Dimension and my back end is Oracle, but i am unable to user this transformer can you please look in this. Regards,...
0
by: BRAHM | last post by:
Hi everyone. I have been searching for the web and I have not found a way to set by code textbox and images controls inside of a reportviewer by source code in vb.net 2005. Is there any...
8
by: shyamg | last post by:
plzzz help me............
2
by: mouac01 | last post by:
Currently I'm using hidden input textboxes to store session variables (eg. login_id, first_name, last_name). So when I need to use the values in a fuction I would do login_id.value, etc.. I'm...
7
by: =?Utf-8?B?TG91IDYy?= | last post by:
010498007741048 This number pops up in search boxes at intermittent times..I have no idea why it does or how to delete it. Could it be some kind of malware or virus/spyware running in the...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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...
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
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...

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.