Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2009, 02:58 PM
Authorized User
 
Join Date: Sep 2007
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.
 
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.
 
Old July 27th, 2009, 01:21 PM
Authorized User
 
Join Date: Sep 2007
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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding a comboBox to update a listView Amethyst1984 VB How-To 2 February 28th, 2006 03:07 PM
Issue Binding to ComboBox. lam_lvl VB.NET 2002/2003 Basics 1 February 22nd, 2006 09:38 PM
data binding a combobox ozPATT Excel VBA 1 November 16th, 2005 08: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.