Results 1 to 2 of 2

Thread: Manual Data Binding

  1. #1

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    Manual Data Binding

    Well, I thought for sure I could figure this out on my own, but that's what I get for thinking. I get a DataSet from a web service, and want to bind some form objects to it. Do the regular next, previous, add new etc. Here's what I've got so far:
    Code:
    		private void Call_Load(object sender, System.EventArgs e)
    		{
    			ds = wsMain.GetTable("vActiveCalls");
    			tbORI.DataBindings.Add("Text", ds.Tables[0], "ORI");
    			tbCallNumber.DataBindings.Add("Text", ds.Tables[0], "Call_Number");
    		}
    
    		private void btnNext_Click(object sender, System.EventArgs e)
    		{
    			bmb = tbCallNumber.BindingContext[ds, "vActiveCalls"];
    			bmb.Position += 1;
    		}
    During the form's Load method, things seem to work fine, my text boxes show the data from the first record. When I click btnNext, the position changes, but the text box values don't change. I keep thinking I'm missing something basic, but can't figure it out.

    Any info appreciated,
    Mike

  2. #2

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    I could have sworn I already posted a reply, but it didn't show up. This works ok:
    Code:
    		private void btnNext_Click(object sender, System.EventArgs e)
    		{
    			tbCallNumber.DataBindings[0].BindingManagerBase.Position ++;
    		}
    I guess I thought you could do it once, and not once for each control.

    Edit: You only have to do it once, as changing the position of BindingManagerBase affects all controls.
    Last edited by Mike Hildner; Sep 8th, 2004 at 03:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width