Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
Error 2 Handles clause requires a WithEvents
posted

VS2008

Infragistics 2009.2

 

Hi!

I have a problem with the VS2008 designer and Infragistics 2009.2 Wingrid...

In my appl (Vb.Net) I have a standard form with a wingrid inside (Framework built with C#). This is the form used as base for all forms in the appl... When I create a form inheriting from this standard form I can´t manage events from the editor...

I can see the grid and dbl-click on it... Doing this, an event its created:

Private Sub grdList_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles grdList.InitializeLayout

So, the error appears:

Error 2 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. c:\Proyectos\Proyect1\Sources\Net35\Administration\BrandForm.vb 30 153 Forms.Infragistics

Any idea?

Edit:

Important info...

The wingrid inside the standard form it is not an UltraWinGrid.
It is a grid base from the same framework, built outside the designer
as a simple class DataGrid.cs). It´s instantiated inside the standard
form as:

this.grdList = new CPCS.AppFwk.Controls.Infragistics9.DataGrid();

public CPCS.AppFwk.Controls.Infragistics9.DataGrid grdList;

Could this be the problem???

DataGrid.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infragistics.Win.UltraWinGrid;

namespace CPCS.AppFwk.Controls.Infragistics9
{
    public class DataGrid : UltraGrid, IDataGrid
    {
        IDictionary _prevColumnActivation;

        public DataGrid()
        {
            _prevColumnActivation = new Dictionary();
            DisplayLayout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;
            DisplayLayout.EmptyRowSettings.ShowEmptyRows = true;
            DisplayLayout.GroupByBox.Hidden = true;
            DisplayLayout.MaxBandDepth = 1;
            DisplayLayout.MaxColScrollRegions = 1;
            DisplayLayout.MaxRowScrollRegions = 1;
            DisplayLayout.Override.AllowAddNew = AllowAddNew.No;
            DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
            DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
            DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
            DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect;
            DisplayLayout.Override.HeaderClickAction = HeaderClickAction.SortMulti;
            DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.WindowsXPCommand;
            DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.CellsOnly;
            DisplayLayout.Override.FilterUIType = FilterUIType.FilterRow;
        }
        protected override void InitLayout()
        {
            base.InitLayout();
        }

        private Boolean _enabled;
        public new Boolean Enabled
        {
            get
            {
                return _enabled;
            }
            set
            {
                _enabled = value;
                ChangeEnableColumn(value);
            }
        }

        #region IDataGrid Members


        public void SetSortInformation(IDictionary sortInformation)
        {
            sortInformation.Clear();
            foreach (UltraGridColumn column in DisplayLayout.Bands[0].SortedColumns)
            {
                sortInformation.Add(column.Key, Helpers.DataGrid.ConvertSortIndicator2SortOrderOperator.Convert(column.SortIndicator));
            }
        }

        #endregion

        private void ChangeEnableColumn(bool enable)
        {
            foreach (UltraGridColumn column in DisplayLayout.Bands[0].Columns)
            {
                if (enable)
                {
                    if (_prevColumnActivation.ContainsKey(column))
                        column.CellActivation = _prevColumnActivation[column];
                    else
                        column.CellActivation = Activation.AllowEdit;
                }
                else
                {
                    if (!_prevColumnActivation.ContainsKey(column))
                        _prevColumnActivation.Add(column, column.CellActivation);
                    else
                        _prevColumnActivation[column] = column.CellActivation;
                    column.CellActivation = Activation.NoEdit;
                }
            }
        }
    }
}

Regards,

Daniel

PD: sorry my english!!

 

Parents Reply Children
No Data