EditBox.Text returns text from next record, not currently shown when bindnavigator delete is hit?

Last post 05-16-2008 10:39 PM by mbanavige. 1 replies.

Sort Posts:

  • EditBox.Text returns text from next record, not currently shown when bindnavigator delete is hit?

    05-16-2008, 5:03 PM
    • Loading...
    • zombieboy
    • Joined on 04-16-2008, 9:04 PM
    • Posts 8

    Hi Gurus!

    Anyone that can help out here I will nominate for the Nobel Price... 

     

    private
    void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)

    {

    // Delete button on navigate is pressed. Delete blog from db given it's ID from the BlogID text box shown

    serviceBlog.DeleteBlog( Convert.ToInt32(textBoxBlogID.Text) );

    // Why, o why does textBoxBlogID.Text return text from the next record in the Datasource ???

    // I can clearly see on-screen the current value !!!

    // I have not yet moved to the next record, so I should still see the

    // "to-be-deleted" records text value, right?

    // If it's supposed to work like this, i.e. the old record is already deleted (and gui is not synced with value retrieved),

    // how do I get handle to its former textBoxBlogID.Text value ????

    // Not sure how I reload the table from webservice yet probably something like this:

    dt.Clear();

    bindingSource1.Clear();

    dt = serviceBlog.SearchFreeTextBlog(textBoxSearchString.Text);

    bindingSource1.DataSource = dt;

    }

    private void BindBlogs()

    {

    // This is done as soon as the form is loaded

    // Assign dt =  DataTable  some records

    dt = serviceBlog.SearchFreeTextBlog( textBoxSearchString.Text );

    // Assign the DataSet as the DataSource for the BindingSource.

    bindingSource1.DataSource = dt;

    bindingNavigator1.BindingSource = bindingSource1;

    // Bind the Title field to the TextBox control.

    textBoxBlogTitle.DataBindings.Add(

    new Binding("Text", this.bindingSource1,"Title", true));

    textBoxBlogText.DataBindings.Add(

    new Binding("Text", this.bindingSource1,

    "BlogText", true));

    textBoxBlogDateTime.DataBindings.Add(

    new Binding("Text", this.bindingSource1,"Timestamp", true));

    textBoxBlogID.DataBindings.Add(

    new Binding("Text", this.bindingSource1,

    "BlogID", true));

    }

    Thanks a billion,

    Zombieboy

  • Re: EditBox.Text returns text from next record, not currently shown when bindnavigator delete is hit?

    05-16-2008, 10:39 PM
    • Loading...
    • mbanavige
    • Joined on 11-06-2003, 8:29 AM
    • New England, USA
    • Posts 7,376
    • Moderator
      TrustedFriends-MVPs

    The BindingNavigator control appears to be used in Windows Forms applications, but these forums are for ASP.NET (web sites / web applications). If you're looking for help with a Windows application, you might try your question at the MSDN Forums which deals with Windows Applications written for .NET.

    Mike Banavige
    ~~~~~~~~~~~~
    Dont forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Page 1 of 1 (2 items)