Releasing ResultsForm, a .NET 6 Component to display Output and Results log
Hi everyone,
Today, I am releasing ResultsForm. This is my first .NET 6 project.
ResultsForm is a .NET 6 Windows Forms class that you can use to pass a List(Of String) object to show your software output or results in a nice, simple form. It can save its output as a log file and the form can be customized.
To use this form, you can simply call it like this in VB.NET
'Create the List Of String object and add an item.
Dim logItems as New List(Of String)
logItems.Add(Now.ToString() + " || This is a log item")
'Create the forms object and pass the List of Strings object to it. Then show the form.
Dim results As New ResultsForm.ResultsForm With {
.ResultItems = logItems
}
results.ShowDialog()
This will have the following output:
You can customize the “Output Log:” label by using the FormMessage attribute:
'Create the List Of String object and add an item.
Dim logItems As New List(Of String)
logItems.Add(Now.ToString() + " || This is a log item")
'Create the forms object and pass the List of Strings object to it. Then show the form.
Dim results As New ResultsForm.ResultsForm With {
.ResultItems = logItems,
.FormMessage = "The results are below:"
}
This will have the following output:
The default log filename will be “Log.log”, but you can change it by passing a file name without the extention to the DefaultLogFilename attribute:
'Create the List Of String object and add an item.
Dim logItems As New List(Of String)
logItems.Add(Now.ToString() + " || This is a log item")
'Create the forms object and pass the List of Strings object to it. Then show the form.
Dim results As New ResultsForm.ResultsForm With {
.ResultItems = logItems,
.FormMessage = "The results are below:",
.DefaultLogFilename = "Results"
}
Then, when clicking the “Save Log” button, the default filename will be “Results.log”
If you are localizing your software, or if it is by default in Spanish, you can specify the language by using the Language attribute and passing the value “es”:
'Create the List Of String object and add an item.
Dim logItems As New List(Of String)
logItems.Add(Now.ToString() + " || Esta es una entrada en el log.")
'Create the forms object and pass the List of Strings object to it. Then show the form.
Dim results As New ResultsForm.ResultsForm With {
.ResultItems = logItems,
.Language = "es"
}
This will have the following output:
As you can see, this is a very simple form that may come useful in your software. You can give it a try by cloning the repo, compiling it and importing it in your projects. The repo is located here. You can also download a precompiled dll file here ready to be imported in your projects.
I will be using this form in some of my media encoding software to provide a better output detail than just the currently “Finished” message they show. This change will provide more details to the user as to what was done correctly and what items were skipped.
Let me know what you think of this software component!