locked
How do I add a TextBox to read from a special coloumn... RRS feed

  • Question

  • How do I get a textbox to read data from the BindingSource, like the one you see in My Movie Collection Starter Kit. Do you see the small DataBase icon next to the property Text of TitleTextBox. How Do I get to do my App that. I have a Database connected.
    Friday, July 7, 2006 9:40 PM

Answers

  • First you *need* to connect to a Data Source.

    - Open Data Source window

    - Add New Datasource

    - Choose DataBase

    - [follow steps to choose your connection, tables, sprocs, etc]

    - ensure that you see your database data source in the Data Source window

     

    Then you have a few options:

    1) create new textboxes and controls from scratch using Drag n Drop

    - select the node corresponding to your table name, e.g. "DVDs" in the Data Source window

    - using the Combobox next to the table name, change the value from Grid to Details.  This lets you drag n drop individual details controls like TextBoxes.

    - drag and drop either the entire table, or one of the individual columns onto your form.  This creates the BindingSource and the data bound TextBox.

    2) data bind to existing textboxes and controls using Drag n Drop ("Connect the dots")

    - Ensure that you've added a Textbox to your form

    - Drag the field you want to bind, e.g. "Id", from the Data source window right onto your textbox.  You should see the cursor change to a (+).  This creates a Binding Source and sets the binding.

    3) Use the property grid to set (DataBindings)

    - Once you have a configured BindingSource and Textbox,

    - Expand the (DataBindings) section in the Property Grid

    - click the dropdown Combobox next to the Text property in (DataBindings)

    - Select your Binding Source and the field inside it you care about, e.g. "Id"

     

    Hope this helps.

     

    Paul

    Saturday, July 8, 2006 12:07 AM

All replies

  • First you *need* to connect to a Data Source.

    - Open Data Source window

    - Add New Datasource

    - Choose DataBase

    - [follow steps to choose your connection, tables, sprocs, etc]

    - ensure that you see your database data source in the Data Source window

     

    Then you have a few options:

    1) create new textboxes and controls from scratch using Drag n Drop

    - select the node corresponding to your table name, e.g. "DVDs" in the Data Source window

    - using the Combobox next to the table name, change the value from Grid to Details.  This lets you drag n drop individual details controls like TextBoxes.

    - drag and drop either the entire table, or one of the individual columns onto your form.  This creates the BindingSource and the data bound TextBox.

    2) data bind to existing textboxes and controls using Drag n Drop ("Connect the dots")

    - Ensure that you've added a Textbox to your form

    - Drag the field you want to bind, e.g. "Id", from the Data source window right onto your textbox.  You should see the cursor change to a (+).  This creates a Binding Source and sets the binding.

    3) Use the property grid to set (DataBindings)

    - Once you have a configured BindingSource and Textbox,

    - Expand the (DataBindings) section in the Property Grid

    - click the dropdown Combobox next to the Text property in (DataBindings)

    - Select your Binding Source and the field inside it you care about, e.g. "Id"

     

    Hope this helps.

     

    Paul

    Saturday, July 8, 2006 12:07 AM
  • Yeah, It does a lot. Thank you the veryest much!
    Sunday, July 9, 2006 12:36 PM
  • I have a good one to solve..

    I created a database to store values.  On my form i have multi textboxes to represent each of the database values.  The intent is to change the value in the textboxes thus changing the database.  There are twelve rows and twenty five columns.

    Please, how can I make the textboxes update the database and at the same time display current database info.

    I only seem to get the data to display in one row meaning... a textboxe should only point to one record.

    Thanks

    Shihan

    Tuesday, October 3, 2006 12:17 PM