|
||||||
| CSharp Tutorials Tutorials for C# |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
||||
|
Basic Data Binding in C#
EDIT: If you would prefer to watch this as a video go to this link: Basic Data Binding In C# | Screencast-O-Matic
Basic Data Binding in C# Step 1: Create a new windows C# form and name it contactBookV1 ![]() Step 2: (Optional) Size your form up a bit by clicking on it in the design window and dragging it up and out Step3: (Optional) Select the form in the designer and change the text filed in the properties window to “Contact Book V.1” This will change the text at the top of the form ![]() Step4: Create a new Data base by going to Project >> Add New Item ![]() Step4 (Continued): Chose Service-Based Database and name it MyContacts. ![]() Note: Hit the Cancel button on the Data Source Configuration Wizard. Step5: Right Click on Tables in the Server Explorer Pane (Database Explorer if you are using Express addition) and Select Add New Table from the submenu ![]() Step6: Create your Table by following the below Schema ![]() Note: Set Primary key by selecting the desired cell and hitting the key up on the menu ![]() To make it Auto Increment, go to the Column Properties, Under Identity Specification, set (Is Identity) to yes. ![]() (If the c_id filed is not set up correctly your program will crash when you try to use certain features) Step7: On the menu under file select Save All. Name the database contacts. Step8: Create a new Database Diagram by right clicking the database diagram in the Server / Database Explorer and selecting new Diagram ![]() The below window will pop up. Select “Yes” ![]() A new table will pop up titled “Add Table” Select Contacts from the list and hit Add ![]() Save the Diagram as contactsDiagram Step9: Go back to the Form1.cs *design* tab. From the menu bar select Data >> Add New Data Source ![]() Select Database from the new popup window. Proceed to hit the next button until you get to the final page. On the last page check all the check boxes and hit finish. Step 10: Go to the Data Source Pane and expand the field called Contacts so that you see all the cell names from your database. click on Category and then click on the silver down arrow that appears next to it. Select Combo box from the menu that appears. ![]() Step11: Left Click on each filed in turn and drag it onto the windows form (Do not put c_id on the form) and put them in some type of pattern. You can change the lable to each control the same way we changed the forms text in Step 3 (Note: Make sure you select the lable [Black text] Not the text box [white box]) Your form should now look like this: ![]() Step12: left click the combo box for category on your form. Chose Items from the properties pane and enter in the values Friend, Business, and Other then hit OK button ![]() Step13: Save your work and hit F5, everything should work except saving. You will have to Create a setup to do that. Step14: Time to create that install so everyone can use your application. Select Build on the menu than select Publish contactBookV1 from the submenu. ![]() Hit finish on the window that pops up to accept all the defaults. Inside your project folder you will find a folder called Publish. Grab all of its content and copy it to a disk. Go install it on a computer and go crazy ^_^ (Ehh I think I got all the images in the right spot. If every thing wasnt clear I apologise, this is my first tut.)
__________________
![]()
Last edited by zeroradius; 08-11-2009 at 02:40 PM.. |
|
||||
|
Re: Basic Data Binding in C#
Awesome tutorial! I love the screenshots, looks like you spent some time on them. Nice work. +rep
__________________
Questions and Answers | Online News and Social Bookmarking | Code and Text Collaboration General Chat Forum |
|
||||
|
Re: Basic Data Binding in C#
Nicely done. I love step-by-step stuff (and concept stuff)
![]()
__________________
CodeCall Blog | CodeCall Wiki | Shareware Programming is a branch of mathematics. My CodeCall Blog | My Personal Blog |
|
||||
|
Re: Basic Data Binding in C#
EDIT: I made a video tutorial using better software. See my first post for the link
Thanks guys ^_^ I origonaly did it as a video tutorial but the screencast software I am using (CamStudio) starts to lag after a while so that my naration dosent match with the video so I decided to do it the long way.
__________________
![]()
Last edited by zeroradius; 08-11-2009 at 02:41 PM.. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C#:Tutorial - Download Data | Xav | CSharp Tutorials | 12 | 01-22-2010 04:19 AM |
| C++ Understanding Basic Data Types | WingedPanther | C Tutorials | 9 | 01-11-2009 11:08 AM |
| Choosing the right language / data structure / Interface | ups | General Programming | 1 | 09-20-2008 10:11 AM |
All times are GMT -5. The time now is 10:33 AM.
Amrosama.cc
Arekbulski.cc
Debtboy.cc
Guest.cc
Jaan.cc
James.cc
Mathx.cc
Tsz.cc
Vswe.cc