private bool UpdateClassDescription(ClassListControls curControl) { string ns = string.Empty; string className = string.Empty; if (curControl == ClassListControls.ClassTreeView) { if (classList.SelectedNode != null) { ns = classList.SelectedNode.Parent.Text; className = classList.SelectedNode.Text; } } else //this is a selected class list { //see if this is a multiple selection (or nothing is selected) and clear description in this case if (selectedClassList.SelectedIndices.Count != 1) { descr.Text = string.Empty; return(true); } string relPath = selectedClassList.SelectedItem.ToString(); ns = relPath.Substring(0, relPath.IndexOf(":")); className = relPath.Substring(relPath.IndexOf(":") + 1); // MessageBox.Show(path); } ISWbemObject obj = WmiHelper.GetClassObject(machineName, ns, className); string theDescr = WmiHelper.GetClassDescription(obj); if (theDescr != string.Empty) { //Add special handling for newlines: change all "\n" to System.Environment.NewLine: int i = -1; string theRest = theDescr; string theStart = string.Empty; while ((i = theRest.IndexOf("\n")) >= 0) { theStart = theStart + theRest.Substring(0, i) + System.Environment.NewLine; theRest = theRest.Substring(i + 1); } theDescr = theStart + theRest; descr.Text = theDescr; return(true); } else { descr.Text = WMISys.GetString("WMISE_NoDescr"); return(false); } }