AnsweredAssumed Answered

Search box/button for ITableBinding?

Question asked by jlavis54 on Dec 15, 2014

I have created windows form application using ITableBinding sample. I have bound the ITable to a several text boxes in my form instead of using the the Grid View.  I would like add search box and button to using a "CASENUMBER Field in my ITable.  Can someone provide a example or get this newbie pointed in the right direction. Thanks for your reply.

 

private void MainWnd_Load(object sender, EventArgs e)
    {
        // Get workspace and open mdb file, Connects to FGDB only 
        IWorkspaceFactory2 wkspcFactory = (IWorkspaceFactory2)new FileGDBWorkspaceFactoryClass();
        IFeatureWorkspace wkspc = wkspcFactory.OpenFromFile(
        // sample connections  
        
        @"\\gislib\development\RFCD WebApp\RFCD_PerVio.gdb",
        Handle.ToInt32()) as IFeatureWorkspace;
        //open the Geodatabase table
        ITable foundITable = wkspc.OpenFeatureClass("Complaints") as ITable;
        if (null != foundITable)
                   
        {
            // Bind dataset to the binding source
            tableWrapper = new ArcDataBinding.TableWrapper(foundITable);
            bindingSource1.DataSource = tableWrapper;
            // Bind binding source to grid. Alternatively it is possible to bind TableWrapper
            // directly to the grid to this offers less flexibility
            // Comment out JLA 
            //dataGridView1.DataSource = bindingSource1;
            // Bind binding source to text box, we are binding the fields.
            txtBoxBinding = new Binding("Text", bindingSource1, "CASENUMBER");
            textBox1.DataBindings.Add(txtBoxBinding);
            txtBoxBinding = new Binding("Text", bindingSource1, "TAX_CODE");
            textBox2.DataBindings.Add(txtBoxBinding);
            txtBoxBinding = new Binding("Text", bindingSource1, "TRS");
            textBox3.DataBindings.Add(txtBoxBinding);
            txtBoxBinding = new Binding("Text", bindingSource1, "OBJECTID");
            
        }
}

Outcomes