Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > WinForms/Console Application Design
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the WinForms/Console Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 24th, 2009, 02:58 PM
Authorized User
 
Join Date: Sep 2007
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default binding combobox to textbox

Hi to all friends out there. I am not able to understand that how i will bind combo box to text box such that when user select item from combo box ,it fill all text box automatically.Both combo box and text box are bound to same data source.

please help me.

Thank you.
  #2 (permalink)  
Old July 27th, 2009, 10:37 AM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Binding ComboBox and TextBox to each other.

Hi,

It is simple way to bind the combobox to textbox try the code

Code:
this. combTest.DataSource = this.customerDS.Tables["CustomerDB"];
this. combTest.DisplayMember = "Cust_Code";
this. combTest.ValueMember = "Cust_Code";
this.txtBox.DataBindings.Add("Text", this. customerDS, "CustomerDB.Cust_Name");
In same way binding the other text box to other related fields.
  #3 (permalink)  
Old July 27th, 2009, 01:21 PM
Authorized User
 
Join Date: Sep 2007
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your reply.


But there is problem in using this code it is working only in forward direction means as i am moving forward by selecting items from com box i am losing previous value's of corresponding text box data bind field.

In other word whatever i selected once i can not get value again in textbox .it is removing values from that field which is bind to textbox.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding a comboBox to update a listView Amethyst1984 VB How-To 2 February 28th, 2006 02:07 PM
Issue Binding to ComboBox. lam_lvl VB.NET 2002/2003 Basics 1 February 22nd, 2006 08:38 PM
data binding a combobox ozPATT Excel VBA 1 November 16th, 2005 07:17 AM
binding combobox to sqlreader? drachx General .NET 6 October 14th, 2004 07:10 PM
ComboBox Data Binding bmains VB.NET 0 October 5th, 2004 02:35 PM



All times are GMT -4. The time now is 05:03 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.