We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,031 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to display values simultaneously in 2 textbox

Greetings,
           i am doing a school project which basically deals with forms and an access database.I have various textboxes in a form.I want some textboxes to be filled automatically with a value when another textbox has been filled.

For e.g , if the user fills in the 'Cost' textbox , 'Total amount' should be same as the value the user just entered in Cost.Of course the value in 'Total amount' should be displayed as soon as the user moves to the next textbox, without haveving to clcik on any button 

How can this be done in vb.net ?
Ignore any validation whatsoever i just need to understand how its done

Sorry for putting this as code snippet but i keep getting

The code snippet in your post is formatted incorrectly. Please use the Code button in the editor toolbar when posting whitespace-sensitive text or curly braces.

3
Contributors
3
Replies
14 Hours
Discussion Span
9 Months Ago
Last Updated
6
Views
Question
Answered
Khav
Junior Poster
103 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Use the Leave event in the first textbox as in

Private Sub TextBox1_Leave(sender As Object, e As System.EventArgs) Handles TextBox1.Leave
    TextBox2.Text = TextBox1.Text
    TextBox3.Text = TextBox1.Text
End Sub

This code will be executed as soon as the user leaves the TextBox1 control.

Reverend Jim
Carpe per diem
Moderator
3,600 posts since Aug 2010
Reputation Points: 561
Solved Threads: 447
Skill Endorsements: 32

you can also use textbox text change event for this ,here is an example to in which we have to give qty and price and nettotal will calculated auto.

'use this code on the price textbox's text change event

txtNetTotal.text =val( txtQty.text) * val( txtPrice.text)
M.Waqas Aslam
Master Poster
743 posts since Aug 2011
Reputation Points: 50
Solved Threads: 120
Skill Endorsements: 2

Thanks to both of you
Reverend Jim code snippet worked perfectly

Khav
Junior Poster
103 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 9 Months Ago by Reverend Jim and M.Waqas Aslam

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0764 seconds using 2.68MB