Hi ,
I m in need of highlighting a word or phrase in Ultrawingrid. Is it possible to do this. Currently I m using NetAdvantage for .NET 2007 Vol. 3 CLR 2.0.
Hi there,
Try this code to see if it does what you are looking for:
/// <summary>
/// Finds the phrase.
/// </summary>
/// <param name="g">The WinGrid reference.</param>
/// <param name="s">The string you want to look for.</param>
public static void FindPhrase(UltraGrid g, String s)
{
foreach (UltraGridRow r in g.Rows)
foreach (UltraGridCell c in r.Cells)
if (c.Text.Contains(s))
c.Activate(); //The Cell must be activated first
g.PerformAction(UltraGridAction.EnterEditMode); //Cell must be in Edit mode to perform a selection
c.SelStart = c.Text.IndexOf(s); //Start the Selection
c.SelLength = s.Length; //for this length
g.DisplayLayout.RowScrollRegions[0].FirstRow = r; //for eye candy, make this the first visible row
return;
}
Hi,
This enables us to highlight the first appearance of the text in the grid. How can we extend this to select all appearances of text in all records of the grid?