I'm wondering why this code doesn't work on form load.
Everything works except the item being added to the listview. I just got back into C# syntax,
so can you guys explain this a bit please, thanks ahead.

if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == true)
{ }
else
{
    MessageBox.Show("An error occured in transfering data through the network, please diagnose any"
    + " problems you are having with connecting to the internet.", "Connection Status", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    Environment.Exit(0);
}

ListViewItem lvi = new ListViewItem();
lvi.Text = "Minecraft Steve (Male)";
listView1.Items.Add(lvi);

First set the view property of your listview to 'list'.
By the way you can directly use

listView1.Items.Add("Text");

you should add more info on what kind of information,
or what kind of output you are expecting for your listview.
then maybe I can add a little more info.

Hope this helps ^^

Greetings.

What's not working? In what line of code does the error appear? if it appears.
We need more information.

Been a while since I played with forms but if exceptions are occuring I believe they do not get thrown in form_load and instead are suppressed. It might be worth assigning the code to a button press or to a function called from form_load to see if any exceptions occur.

Someone correct me if im wrong.

Have you set column names? And I would suggest you to set View to Details, not to List or any other type.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.