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

Forms Databinding Question

This question refers to:

http://support.microsoft.com/default...;EN-US;Q313482

First question:
[from article] The following code binds a TextBox control and a DataGrid control to the
same CurrencyManager and DataView: TextBox1.DataBindings.Add("Text", ds,
"Customers.CustomerID")
DataGrid1.DataSource = ds
DataGrid1.DataMember = "Customers"

Alternatively, you can use the following code to bind to different
CurrencyManager and DataView objects: TextBox1.DataBindings.Add("Text",
ds.Tables("Customers"), "CustomerID")
DataGrid1.DataSource = ds.Tables("Customers")

Each of the preceding code samples displays the same data. Edits and
scrolling are not synchronized between examples but are synchronized in them.

I can't see what would cause the first example to share a common currency
manager while the 2nd example would make use of two different
currencymanagers. I'm guessing it has something to do with the placement of
the table in the two examples that causes datasource overlapping in the first
but not in the second example, but I was hoping I could get some elaboration
on this.
My 2nd question:
You can use the Microsoft Visual Studio .NET integrated development
environment (IDE) to bind controls at design time to any class that supports
the IComponent interface. You can also bind at run time.


How does one bind at runtime? It seems like all the examples show design
time binding. Am I mistaken?

Thanks...

-Ben
Aug 16 '05 #1
1 1214
Hi Ben,

1. As far as I know, we can share the CurrencyManager between the datagrid
and TextBox in both two cases. When getting the CurrencyManager, we just
need to specify the exact data source as you do the databinding.

2. As you can see, the code snippet you have posted is using the runtime
binding. When you set the data sources in the property window, the schema
information will be show on the controls(for example, a datagrid) at design
time. The binding code is genereted in the Windows form designer genereted
code region. And the schema will the shown in the windows form designer.
However, the data will be filled in at runtime. For runtime binding,
everything will be done at runtime. There is not much difference between
them.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Aug 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Job Lot | last post by:
How would I send information from DataGrid on the main form of the application to a modal popup form and then pass any changes to the data back to the main form and database when the popup form was...
1
by: Ben R. | last post by:
Hi, I'm fairly familiar with the databinding model for ASP.NET, but now I'm trying to do the same with a C# windows forms application. I'm noticing several differences: Firstly, there never...
4
by: Jason S | last post by:
I haven't been able to find a clear answer to this and I'm hoping someone could enlighten me. As pertains to databinding a control in a repeating fashion(datagrid, repeater, etc.) what event...
7
by: Justin Hoffman | last post by:
I am new to vb.net programming and am just exploring the way databinding works with Windows forms and am having trouble with some fairly basic customization of data entry. The form uses the...
9
by: Dennis | last post by:
I have tried using Databinding for my application but always seem to find it very restrictive (maybe I don't completely understand it enough). I always seem to find it much easier to display a...
1
by: Ben R. | last post by:
This question refers to: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q313482 First question: >> The following code binds a TextBox control and a DataGrid control to the same...
1
by: dmeglio | last post by:
I'm creating a C# program and I need something similar to MS Access's Continuous Forms feature. I stumbled on to http://www.ewoodruff.us/EWSListControls.aspx which provides exactly what I want....
1
by: Wan | last post by:
Hi, I have a test project consists of two forms. The main form contains a datagrid and a button. On click of button I populate the datagrid with a ds.table(0) so far so good and on grid's...
0
by: sammartin | last post by:
Hi, I've got a question which I'm hoping has a simple answer. I have a series of control bound to an underlying DataTable. The databinding are setup to update the data source on validation....
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
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,...
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
jinu1996
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...

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.