Infragistics(R) NetAdvantage(R) Windows Forms
UltraGrid Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : UltraGrid Class

Glossary Item Box

The Infragistics UltraGrid control is designed to present, and optionally edit, both flat data (containing a single set of rows and columns) as well as hierarchical data in a variety of view styles.

Syntax

Visual Basic (Declaration) 
Public Class UltraGrid 
   Inherits UltraGridBase
   Implements Infragistics.Shared.IUltraLicensedComponent, Infragistics.Shared.Serialization.ICodeDomSerializable, Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.CalcEngine.IUltraCalcParticipant, Infragistics.Win.ISelectionManager, Infragistics.Win.ISupportPresets, Infragistics.Win.IUIElementProvider, Infragistics.Win.IUIElementTextProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.IValidatorClient 
C# 
public class UltraGrid : UltraGridBase, Infragistics.Shared.IUltraLicensedComponent, Infragistics.Shared.Serialization.ICodeDomSerializable, Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.CalcEngine.IUltraCalcParticipant, Infragistics.Win.ISelectionManager, Infragistics.Win.ISupportPresets, Infragistics.Win.IUIElementProvider, Infragistics.Win.IUIElementTextProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.IValidatorClient  

Remarks

Most of the settings that apply to the control are set off the UltraGridBase.DisplayLayout property.

The following code snippet illustrates.

            private void button5_Click(object sender, System.EventArgs e)
            {
            	this.ultraGrid1.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
            	this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Hidden = true;
            }
            

Example

Following code sets some of the commonly used properties of the UltraGrid in the Form's Load event.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

      Me.OleDbDataAdapter1.Fill(Me.DataSet11)
      Me.OleDbDataAdapter2.Fill(Me.DataSet11)
      Me.OleDbDataAdapter3.Fill(Me.DataSet11)

      ' Set the data source and data member to bind the grid.
      Me.UltraGrid1.DataSource = Me.DataSet11
      Me.UltraGrid1.DataMember = ""

      ' Disable alpha-blending which may increase performance.
      Me.UltraGrid1.AlphaBlendEnabled = False

      ' Disable theme support in WinXP based systems.
      Me.UltraGrid1.SupportThemes = False

      ' Set the appearance of the UltraGrid.
      Me.UltraGrid1.DisplayLayout.Appearance.BackColor = Color.Gray

      ' Set the border style of the UltraGrid.
      Me.UltraGrid1.DisplayLayout.BorderStyle = UIElementBorderStyle.InsetSoft

      ' Set the text, appearance and border styles of the caption.
      Me.UltraGrid1.Text = "UltraGrid Caption"
      Me.UltraGrid1.DisplayLayout.CaptionAppearance.FontData.Bold = DefaultableBoolean.True
      Me.UltraGrid1.DisplayLayout.BorderStyleCaption = UIElementBorderStyle.RaisedSoft

      ' Set the update mode which dictates when the UltraGrid calls EndEdit
      ' on IEditableObject row objects.
      Me.UltraGrid1.UpdateMode = UpdateMode.OnRowChangeOrLostFocus

      ' Set the scroll style to Immediate so that the UltraGrid scrolls the rows as
      ' the vertical scroll bar thumb is dragged. Normally the UltraGrid defers the
      ' scrolling until the thumb is released and displays scroll tips instead.
      Me.UltraGrid1.DisplayLayout.ScrollStyle = ScrollStyle.Immediate

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void Form1_Load(object sender, System.EventArgs e)
{

	this.oleDbDataAdapter1.Fill( this.dataSet11 );
	this.oleDbDataAdapter2.Fill( this.dataSet11 );
	this.oleDbDataAdapter3.Fill( this.dataSet11 );

	// Set the data source and data member to bind the grid.
	this.ultraGrid1.DataSource = this.dataSet11;
	this.ultraGrid1.DataMember = "";

	// Disable alpha-blending which may increase performance.
	this.ultraGrid1.AlphaBlendEnabled = false;

	// Disable theme support in WinXP based systems.
	this.ultraGrid1.SupportThemes = false;
	
	// Set the appearance of the UltraGrid.
	this.ultraGrid1.DisplayLayout.Appearance.BackColor = Color.Gray;

	// Set the border style of the UltraGrid.
	this.ultraGrid1.DisplayLayout.BorderStyle = UIElementBorderStyle.InsetSoft;			

	// Set the text, appearance and border styles of the caption.
	this.ultraGrid1.Text = "UltraGrid Caption";
	this.ultraGrid1.DisplayLayout.CaptionAppearance.FontData.Bold = DefaultableBoolean.True;
	this.ultraGrid1.DisplayLayout.BorderStyleCaption = UIElementBorderStyle.RaisedSoft;			
	
	// Set the update mode which dictates when the UltraGrid calls EndEdit
	// on IEditableObject row objects.
	this.ultraGrid1.UpdateMode = UpdateMode.OnRowChangeOrLostFocus;

	// Set the scroll style to Immediate so that the UltraGrid scrolls the rows as
	// the vertical scroll bar thumb is dragged. Normally the UltraGrid defers the
	// scrolling until the thumb is released and displays scroll tips instead.
	this.ultraGrid1.DisplayLayout.ScrollStyle = ScrollStyle.Immediate;

}

See Also