I have previously populated a listbox / dropdown list with data from a stored procedure in ASP.NET C# and called the method in the PageLoad so that the list would be available once the page loaded up.

However, now I want to do the same thing except I want to do it for a Windows Application and not a website. So, how can I make the listbox automatically display the results of the sproc?

public void getCompanyName() //Method to return list of company names and add to listbox
            //Clear the listbox
            //Create SQL command, declare SPROC and connection to database
            myCommand = new SqlCommand("get_CompanyName", myConnection);
            myCommand.CommandType = CommandType.StoredProcedure;
            //Open database connection

            //Execute myCommand into the reader and close the connection
            myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

            while (myReader.Read())
                //Loop through the reader appending each element to the listbox

Has anyone any ideas please? :)