|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using Binding object on another formI 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 No problems,
I just decided to keep the code on the parent form & have it execute after testing for a DialogResult property Cheers Ant Show quote "Ant" wrote: > 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 >
Other interesting topics
|
|||||||||||||||||||||||