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 designeras a simple class DataGrid.cs). It´s instantiated inside the standardform as:this.grdList = new CPCS.AppFwk.Controls.Infragistics9.DataGrid();public CPCS.AppFwk.Controls.Infragistics9.DataGrid grdList;Could this be the problem???DataGrid.csusing 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!!
When you declare any control in VB and you want to be able to hook the events on that control, you have to declare it WithEvents. This has nothing specifically to do with the WinGrid, it applies to any control.
So, from the error message, it sounds like your base form is declaring the grid variable without specifying WithEvents.
Hi Mike!
Remember that my base form its a C# form... No WithEvents option it´s available... (or I'm missing something?)
Daniel.
Anyone?
You might want to try this with some other control. I can't see any reason why this would be limited to the grid, it's probably a general problem in DotNet when you declare a variable in C# and try to use it in VB.