Seems, you forgot to initiate your variable...
private void lstFiles_DoubleClick(object sender, EventArgs e)
{
if (lstFiles.SelectedItem != null)
{
fileName = lstFiles.SelectedItem.ToString();
FileInfo fileInfo = new FileInfo(fileName);
Extra notes:
1)
One of the most important skill of developer is to use debugger.
First look at the debugger - Visual Studio | Microsoft Docs[
^]
Debugging in Visual Studio - Visual Studio | Microsoft Docs[
^]
This may help you to resolve most of issues.
2)
What's for are thsese lines?
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
I'd suggest to remove unused namespaces in
using
section.
First method:
Organise Usings > Remove Unused Usings
Second method:
[Ctrl] + [R] + [G]