Hi Wizards,
I have a data set and I bound it to 2 combobox (say ComboBox1 and ComboBox2)
using ComboBox1.DataS ource = MyDataSet and it worked well. That also means
that when I select an item from ComboBox1, then SelectedItem in ComboBox2
will also changed respectively, as well.
However, the problem is when I tried to bind the same dataset to a TextBox
using:
TextBox1.DataBi nding.Add(new Binding("Text", MyDataSet.Table s["Table1"],
"MyDataColumn") );
It happened to be that, when selectedItem is changed in ComboBox1, the data
in TextBox1.Text does not changed. Is there any other codes/method/event
that I missed? Please note that the DataTable in combobox1 and TextBox1 is
the same. The Text in TextBox should have changed as well, right?
Please help! 6 11879
Hi Ahmad,
What is your code for combobox binding?
I think your problem is that you use different format for binding combos and
textbox thus two bindingmanagers are created and not synchronized.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
"Ahmad A. Rahman" <je************ @yahoo.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Hi Wizards,
I have a data set and I bound it to 2 combobox (say ComboBox1 and
ComboBox2) using ComboBox1.DataS ource = MyDataSet and it worked well. That also means that when I select an item from ComboBox1, then SelectedItem in ComboBox2 will also changed respectively, as well.
However, the problem is when I tried to bind the same dataset to a TextBox using:
TextBox1.DataBi nding.Add(new Binding("Text", MyDataSet.Table s["Table1"], "MyDataColumn") );
It happened to be that, when selectedItem is changed in ComboBox1, the
data in TextBox1.Text does not changed. Is there any other codes/method/event that I missed? Please note that the DataTable in combobox1 and TextBox1 is the same. The Text in TextBox should have changed as well, right?
Please help!
Hi,
Here's a few lines from the codes:
//-- code start --//
//I have a combobox ComboBox1 and I've already set the DisplayMember and
ValueMember at design time.
// businesslogic return a dataset with a table and that table name is
MyTable
// I set the DisplayMember = MyTable.TestKey and ValueMember =
MyTable.TestKey at design time
DataSet ds = BusinessLogic.E xecute("select TestKey, TestDesc from Test",
"MyTable");
ComboBox1.DataS ource = ds;
// now I want to bind the data to the TextBox.Text
TextBox1.DataBi nding.Add(new Binding("Text", ds.Tables["MyTable"],
"TestDesc") ;
//-- code end --//
So, I supposed, when the SelectedItem in ComboBox1 is changed, I thought
data in TextBox1.Text will also change. But that didn't happened.
So, what is the problem here?
Thanx.
Hi Ahmad,
I think your problem lies in fact that once you are using ds as datasource
while for the textbox you are using the table.
Try this:
ComboBox1.DataS ource = ds.Tables["MyTable"];
Here is my code that works:
//
// comboBox1
//
this.comboBox1. DataSource = this.dataTable1 ;
this.comboBox1. DisplayMember = "Column1";
this.comboBox1. ValueMember = "Column1";
//
// comboBox2
//
this.comboBox2. DataSource = this.dataTable1 ;
this.comboBox2. DisplayMember = "Column1";
this.comboBox2. ValueMember = "Column1";
//
// textBox1
//
this.textBox1.D ataBindings.Add (new System.Windows. Forms.Binding(" Text",
this.dataTable1 , "Column1")) ;
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
"Ahmad A. Rahman" <je************ @yahoo.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Hi,
Here's a few lines from the codes:
//-- code start --// //I have a combobox ComboBox1 and I've already set the DisplayMember and ValueMember at design time. // businesslogic return a dataset with a table and that table name is MyTable // I set the DisplayMember = MyTable.TestKey and ValueMember = MyTable.TestKey at design time
DataSet ds = BusinessLogic.E xecute("select TestKey, TestDesc from Test", "MyTable");
ComboBox1.DataS ource = ds;
// now I want to bind the data to the TextBox.Text TextBox1.DataBi nding.Add(new Binding("Text", ds.Tables["MyTable"], "TestDesc") ; //-- code end --//
So, I supposed, when the SelectedItem in ComboBox1 is changed, I thought data in TextBox1.Text will also change. But that didn't happened.
So, what is the problem here?
Thanx.
You mean, I should use a DataTable that does not belong to any DataSet?
because refering to your codes, the only difference between my codes and
yours is that, my codes used a datatable in a dataset while yours is not.
Your codes working means that, when you change the SelectedItem in
ComboBox1, the TextBox.Text value also changed as well? Is it?
Why is it not working on mine?
"Miha Markic" <miha at rthand com> wrote in message
news:OF******** ******@tk2msftn gp13.phx.gbl... Hi Ahmad,
I think your problem lies in fact that once you are using ds as datasource while for the textbox you are using the table. Try this:
ComboBox1.DataS ource = ds.Tables["MyTable"];
Here is my code that works: //
// comboBox1
//
this.comboBox1. DataSource = this.dataTable1 ;
this.comboBox1. DisplayMember = "Column1";
this.comboBox1. ValueMember = "Column1";
//
// comboBox2
//
this.comboBox2. DataSource = this.dataTable1 ;
this.comboBox2. DisplayMember = "Column1";
this.comboBox2. ValueMember = "Column1";
//
// textBox1
//
this.textBox1.D ataBindings.Add (new System.Windows. Forms.Binding(" Text", this.dataTable1 , "Column1")) ;
-- Miha Markic - RightHand .NET consulting & development miha at rthand com
"Ahmad A. Rahman" <je************ @yahoo.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Hi,
Here's a few lines from the codes:
//-- code start --// //I have a combobox ComboBox1 and I've already set the DisplayMember and ValueMember at design time. // businesslogic return a dataset with a table and that table name is MyTable // I set the DisplayMember = MyTable.TestKey and ValueMember = MyTable.TestKey at design time
DataSet ds = BusinessLogic.E xecute("select TestKey, TestDesc from Test", "MyTable");
ComboBox1.DataS ource = ds;
// now I want to bind the data to the TextBox.Text TextBox1.DataBi nding.Add(new Binding("Text", ds.Tables["MyTable"], "TestDesc") ; //-- code end --//
So, I supposed, when the SelectedItem in ComboBox1 is changed, I thought data in TextBox1.Text will also change. But that didn't happened.
So, what is the problem here?
Thanx.
"Ahmad A. Rahman" <je************ @yahoo.com> wrote in message
news:uP******** ********@TK2MSF TNGP11.phx.gbl. .. You mean, I should use a DataTable that does not belong to any DataSet? because refering to your codes, the only difference between my codes and yours is that, my codes used a datatable in a dataset while yours is not.
Why do you think my is not in a dataset?
It is.
Your codes working means that, when you change the SelectedItem in ComboBox1, the TextBox.Text value also changed as well? Is it?
Yup.
Why is it not working on mine?
Because the datasource matters - if you want to synchronize it you should
use the same.
You can't use ds for combobox and ds.Tables["MyTable"] for text box -
because the first is a dataset and the second is a datatable.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
Now it's working!!!! Obviously the datasource is the keypoint to this
problem.
Thanks a lot Miha. You really are a great help.
-cheers- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anurag Saxena |
last post by:
If someone can solve this problem,I am using ASP3.0 and IIS on windows
2000 server
The complete Error is
''''''''''''''''''''''''''''''''''
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/onesource_local/defects.asp, line 41
|
by: dembla |
last post by:
Hey Frnds can anyone help me in this
i need a program in 'c'
PROGRAM to print NxN Matrix
9 1 8 1 2 3
2 7 3 as 4 5 6
6 4 5 7 8 9
in sorted form
|
by: archana |
last post by:
Hi all,
I am having one confusion regarding invoking web method of web service
asychronously through windows applicaiton.
What i am doing is i am having one long runing web method whose one way
attribute is set as i don't want any return value from that method.
What i observered is when my window application start calling web
method asynchronoysly
|
by: alok sengar |
last post by:
hi,
I have already tried this URL's code
"http://www.java2s.com/Code/CSharp/Network/SimpleSNMP.htm"
but I am getting error when i am creating a UDP type Socket and recieving
packet from this socket.
some time error is---"An existing connection was forcibly closed by the
remote host"
and some time error is---
"A connection attempt failed because the connected party did not properly
respond after a period of time, or established...
|
by: sohail28 |
last post by:
Respected Sir,
I try to connect my DB which is present in my hosting server control panel using Dreamweaver MX 2004.
Everything is going fine, except while testing connection configuration, its show error
"An Unidentified Error has occured".
what will be the solution?,
plzzz anyone help me to solve this problem... Its very very Urgent...
| |
by: settyv |
last post by:
Hi,
I need to generate PDF stream when i click on Linkbutton in datagrid
..At present i hardcoded the
DMS Id and now it is working.But i need to pass DMS ID when click
linkbutton.How can i do that?
Here is the ASPX code:
<asp:datagrid id="grdTentativeResults" Width="800" Runat="server"
|
by: rajesh.us.it.recruiter |
last post by:
Hi Guys/Partners,
We have a URGENT Requirement for Perl Programmer with H1 visa in
India/US for one of our prestigious Client. Location : New Jersey
Requirements :
Should be very strong in Perl
Should be strong in SQL, Unix, C++
Should have some knowledge in RDBMS
|
by: jenipriya |
last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors...
The table structures i hav
Employee (EmpID, EmpName,DeptID,DateOfJoin, Sal, Addr)
Finance (EmpID, Sal)
Club (Clubname, EmpID, Fee, DateOfJoin)
Leave (EmpID, Date)
Department (DeptID, DeptName, NoOfEmployees)...
|
by: uppili4chi |
last post by:
Good morning my dear friends,
I am uppili from India. i am working in one mnc. I need a help very urgent.
"My problem i need to write a program for search a file just like search option at start menu in our computer".
plse give idea, if it possible code.. its very urgent...........
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |