Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have created a dockwindow(name:FrmWellConfig) with a datagridview(datagridview1) control in a new ArcMap add-in project.

I then bind the data:

datagridview1.datasouce=wellconfig.tables[wellcolunms];

Why does the datagridview not update?

Code behind tool:

FrmWellConfig frm = new FrmWellConfig(SettingWorkspace.AppBasePath, wellConfigFileName, frmSave.MapType, SettingWorkspace.workspace1.CnnStr_InfoDB);

Code behind FrmWellconfig(wellConfig1 is a dataset):

 /// <summary>
/// Designer class of the dockable window add-in. It contains user interfaces that
/// make up the dockable window.
/// </summary>
public partial class FrmWellConfig : UserControl
{
    private string cnnStr_OLEDB;
    private bool nFlag = false;  
    public static string appBasePath;
    private string wellConfigFileName = "";
    sylMapType mapType;


    public sylMapType MapType
    {
        get { return mapType; }
    }
    public WellConfig WellConfigData
    {
        get { return wellConfig1; }
    }

    public FrmWellConfig(object hook)
    {
        InitializeComponent();
        this.Hook = hook;
        this.dataGridView1.DataError += delegate(object sender, DataGridViewDataErrorEventArgs e) { };
    }


    public FrmWellConfig(string AppBasePath, string WellConfigFileName, sylMapType _mapType, string CnnStr_OLEDB)
    {

        InitializeComponent();
        nFlag = true;       
        frmType = sylChildFormType.DialogForm;
        cnnStr_OLEDB = CnnStr_OLEDB;
        appBasePath = AppBasePath;   
        mapType = _mapType;
        dataGridView1.Columns[0].Visible = false;
        wellConfigFileName = WellConfigFileName;
        wellConfig1.ReadXml(wellConfigFileName);
    }

    /// <summary>
    /// Host object of the dockable window
    /// </summary>
    private object Hook
    {
        get;
        set;
    }

    /// <summary>
    /// Implementation class of the dockable window add-in. It is responsible for 
    /// creating and disposing the user interface class of the dockable window.
    /// </summary>
    public class AddinImpl : ESRI.ArcGIS.Desktop.AddIns.DockableWindow
    {
        private FrmWellConfig m_windowUI;

        public AddinImpl()
        {
        }

        protected override IntPtr OnCreateChild()
        {
            m_windowUI = new FrmWellConfig(this.Hook);
            return m_windowUI.Handle;
        }

        protected override void Dispose(bool disposing)
        {
            if (m_windowUI != null)
                m_windowUI.Dispose(disposing);

            base.Dispose(disposing);
        }

    }
share|improve this question
    
Is there any chance that it is just because you have used datagridview1.datasouce when it should have been datagridview1.datasource? i.e. a missing 'r' –  PolyGeo Jul 27 '13 at 3:27
    
I am sorry ,I Typed wrong in this article,it was right in my project,thanks a lot for edit my article, It is my first time to use this –  Hmily Shao Jul 27 '13 at 6:05
    
Have you thought about using WPF for this? WinForms' datagridview is terrible and requires huge amounts of code to get it to do anything useful. –  blah238 Jul 28 '13 at 4:43
    
It is a good idea..I will have a try ,thanks a lot! –  Hmily Shao Jul 28 '13 at 15:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.