1

I have a Dockable Window and that dockable window consists of a dataGrid. In order to populate that data grid I want to pass a datatable and some more parameters.

Here is what I did:

private void SetupDockableWindow(DataTable dt)
 {
 if (_dockableWindow == null)
 {
 IDockableWindowManager dockWindowManager = _application as 
 IDockableWindowManager;
 if (dockWindowManager != null)
 {
 UID windowID = new UIDClass();
 windowID.Value = _dockableWindowGuid;
 //windowID
 _dockableWindow = 
 dockWindowManager.GetDockableWindow(windowID);
 _dockableWindow.Dock(esriDockFlags.esriDockFloat);
 }
 }
 }

How do I pass the required data to it?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Sep 12, 2017 at 6:55

1 Answer 1

0

You implement Dockable Window yourself, so you can do it like this:

public class MyDockableWindow : Form, IDockableWindowDef
{
 public void Fill(DataTable dt)
 {
 // fill your grid
 }
...
 object IDockableWindowDef.UserData
 {
 get { return this; }
 }
...
}

Then you can fill it like this:

((MyDockableWindow)(_dockableWindow.UserData)).Fill(dt);
answered Sep 13, 2017 at 7:51
3
  • Thanks for the response r.pankevicius. I see the example you have shared. You mean to pass a dataTable or any parameter, I need to have created a method and call it with the dt. I understood that. But in case I have some code on the form load event which requires the dt how can I manage. In my case I want the dataGrid to be populated at the load time. Commented Sep 13, 2017 at 11:10
  • The question was "How do I pass the required data to it?". If you want to do it in form load, create data table there and fill grid there, you don't need to pass it from SetupDockableWindow. Commented Sep 14, 2017 at 12:47
  • Thanks r.pankevicius for replying. I understood. Thanks again. Commented Sep 14, 2017 at 14:25

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.