473,396 Members | 2,023 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,396 software developers and data experts.

Windows Forms Simple Data Binding

I have a screen:

Email address: ------------
Name: --------------
Phone: ----------------

Add, Change, Delete, Cancel, Exit

When the user enters the email address and hits TAB in the
EmailTextBox_Leave method, I create and fill a DataSet with the single
record. I then bind that record to the form controls as such:

EmailTextBox.DataBindings.Add ("Text", ds.Tables["Customers"], "Email");
NameTextBox.DataBindings.Add("Text", ds, "Customers.Name");

I setup a CurrencyManager to check the record count although it should
always be one as the Email is unique:

myCurrencyManager =
(CurrencyManager)this.BindingContext[ds.Tables["Customers"]];
if ( myCurrencyManager.Count == 0) etc.

I'm somewhat new at all this scope/DataSet stuff and I have a lot of best
practices issues. If someone could point me to an example that would be
nice.

How would I setup the textbox to data element binding in the DataSet before
I fill the DataSet? I guess it should be outside the scope of the
EmailTextBox_Leave method in the section where the
"System.Windows.Forms.TextBox EmailTextBox" stuff is defined. Would I have
to manually create the DataSet with all that AddColumn business and then
bind it somehow before I actually filled the DataSet with the single record?
Should I have a myCreateClass : DataSet method that uses a new instance
inside the Leave method? How and where would I setup a get/set property to
easily access a data element by myDataElement.value, etc.

I like having the manual control of doing what I want in the bottom buttons,
etc. so I don't think I'm looking for that generic generated thing that
cycles next record type thing. Although next/previous could be nice
fuctionality and if that's the best way to go fine. The CurrencyManager also
has some nice events for record state changed, etc.

I know in pre-oo days we would call what I'm looking for a 'standard' or
best code example for this specific type of ACID (add, change, inquire,
delete) function. Would the oo term be for this type of standard example for
this type of function?
Nov 15 '05 #1
0 1247

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

Similar topics

5
by: Dave | last post by:
How do I check in a Windows Forms app if any controls have changed? I have a form that collects data, and I want to prompt the user if they try to exit the app, or load a new file, without saving...
14
by: RL Stevenson | last post by:
What is a reasonable way to manage a complex form with 5 or so tabs with 100 or more controls bound to 5-10 tables in a database? Pasting all those controls, datasets, data adapters directly onto...
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...
2
by: adodotnet20 | last post by:
Hi, I need to create an application in C# that will be fairly simple from a UI prospective and that will be able to retrieve some information from a db. The overall look and feel should be nice...
1
by: seanmle | last post by:
I want to build a windows application that has a datagrid filled with data. When a person modifies information on a single cell, it updates the database without the user having to click on a save...
0
by: =?Utf-8?B?QWRyaWFuIENvbGU=?= | last post by:
I have written a simple WCF service hosted in a Windows console application and a simple WCF client console application that connects successfully to that service and retrieves data. I then ported...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
0
by: jehugaleahsa | last post by:
Hello: I have radio buttons bound to boolean properties in a business object. private void bindRadioButton(RadioButton button, string propertyName) { Binding binding =...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
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...

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.