In a debug build, how do I write debug information to the output window (similar to the TRACE macro from VC6)

You can use the Console.Write and Console.WriteLine methods from within a Windows Forms project to do this. The class DefaultTraceListener is used to implement this functionality. When your application is launched from the VS.NET IDE in Debug mode, you will see all trace and debug messages in the Output window by calling: System.Diagnostics.Trace.WriteLine() or System.Diagnostics.Debug.WriteLine()

How do you implement TopLevel Controls

TopLevel controls (like Form) cannot be added into Controls list using Controls.Add(). For example, if you are trying to add a form into a Panel’s control list, it will lead you to an exception ‘Top-level control cannot be added to a control’. To avoid this exception, you need to set the form’s TopLevel property to false. Form form2 = new Form(); form2.TopLevel = false; this.panel1.Controls.Add(form2);

In VB.NET how do I access the runtime type object of a specified type from it’s type name?

Visual Basic has a GetType operator that can be used to obtain the System.Type object for the specified type name. This is the equivalent of the typeof keyword in C#. ’ Returns the System.RuntimeType object representing the integer type. Dim inttype As Type = GetType(Integer) ’ Returns the System.RuntimeType object representing the Project1.Type1 class. Dim mytype As Type = GetType(Project1.Type1)

Is there a way to access private and protected members of a class instance?

.NET Reflection can be used to get hold of non-Public members of a class instance. The System.Type class provides various methods that allow you to access the fields/properties/methods for all defined types. Depending on the context, you can use either the typeof(class) operator or the Object.GetType() method to get hold of the System.Type object representing the particular type and then use that type object to access the required member information. The following code shows how to use the Type.GetField() and FieldInfo.GetValue() methods to determine the value of the ’pasteIndex’ private field implemented by the Diagram.Controller class. // In C#.NET // Use Reflection to access the this.ActiveDiagram.Controller object’s pasteIndex private member Type typecontroller = typeof(Syncfusion.Windows.Forms.Diagram.Controller); System.Reflection.FieldInfo finfo = typecontroller.GetField(‘pasteIndex’, BindingFlags.Instance|BindingFlags.NonPublic|BindingFlags.GetField); int npasteindex = 0; if(finfo != null) npasteindex = (int)finfo.GetValue(this.ActiveDiagram.Controller); ’ In VB.NET ’ Use Reflection to access the Me.ActiveDiagram.Controller object’s pasteIndex private member Dim typecontroller As Type = GetType(Syncfusion.Windows.Forms.Diagram.Controller) Dim finfo As FieldInfo = typecontroller.GetType().GetField(‘pasteIndex’, BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.GetField) Dim npasteindex As Integer = 0 If Not finfo Is Nothing Then npasteindex = finfo.GetValue(Me.ActiveDiagram.Controller) End If