Using Binding object on another form

G

Guest

Hi,
I need to use the find method of a Dataview from a form being used as a
dialog box, to set the position of a Binding object on another form. I think
this is a pretty standard thing.

How do I reference the Binding Context object though as it is on another form?
This is what I’m doing:

// I get a compile error here – object reference required for non static
field
// I understand why this is happening, but how can I get around it?

DataView viewCategories = dsWindowControlMaster.Categories.DefaultView;

// Retrieve the search criteria from the textbox
int id = this.CategoryID;

// Use it with the view to find the index
int idx = viewCategories.Find(id);

// Use the index to set the Binding objects position
// This also cannot be referenced from here
BindingContext[dsWindowControlMaster, "Categories"].Position = idx;

Thanks for any ideas in advance.
Ant
 
G

Guest

No problems,

I just decided to keep the code on the parent form & have it execute after
testing for a DialogResult property

Cheers
Ant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top