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)
{ }
    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);

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

Edited 4 Years Ago by morgan.wowk

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


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 ^^


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.

This article has been dead for over six months. Start a new discussion instead.