How to check if a Form is Open in C# and VB.NET

To Check if a Form is open in C# and VB.NET you can use the snippet below.

Sample C#

public static bool FormIsOpen(FormCollection application, Type formType)
{
	//usage sample: FormIsOpen(Application.OpenForms,typeof(Form2)
	return Application.OpenForms.Cast<Form>().Any(openForm => openForm.GetType() == formType);
}

Sample VB.NET

Public Shared Function FormIsOpen(application__1 As FormCollection, formType As Type) As Boolean
	'usage sample: FormIsOpen(Application.OpenForms,GetType(Form2)
	Return Application.OpenForms.Cast(Of Form)().Any(Function(openForm) openForm.[GetType]() = formType)
End Function

How to scroll to the end of a TreeView in C# and VB.NET

To scroll to the end of a TreeView in C# and VB.NET you can use the following snippet.

Sample VB.NET / C#

treeView1.Nodes[treeView1.Nodes.Count - 1].EnsureVisible();

How to scroll to the end of a listview in C# and VB.NET

To scroll to the end of a listview in C# and VB.NET you can use the following snippet.

Sample C# / VB.NET

listView1.EnsureVisible(listView1.Items.Count - 1);

How to make a seperator line in C# and VB.NET

To make a seperator line in C# and VB.NET you can use the following snippet.

Sample C# / VB.NET

label1.Height = 2;
label1.AutoSize = false;
label1.BorderStyle = BorderStyle.Fixed3D;

Result:

SeperatorLine_NET

A Seperator line in .NET