By Callum


2018-10-11 14:15:55 8 Comments

Looking for a way to display a default value in a list box when launching the program e.g. the second the program is launched a default value is held and displayed in that list box until the user adds their own input?

Any ideas?

1 comments

@user1011627 2018-10-11 14:21:27

You can set a collection of items in the properties window at design time or you can add via code as shown here:

private void Form1_Load(object sender, EventArgs e)
    {
        listBox1.Items.Add("Default Value");
    }

Related Questions

Sponsored Content

56 Answered Questions

[SOLVED] What is the difference between String and string in C#?

26 Answered Questions

[SOLVED] Why not inherit from List<T>?

40 Answered Questions

[SOLVED] Create Excel (.XLS and .XLSX) file from C#

  • 2008-09-29 22:30:28
  • mistrmark
  • 935549 View
  • 1620 Score
  • 40 Answer
  • Tags:   c# .net excel file-io

26 Answered Questions

[SOLVED] How do I enumerate an enum in C#?

21 Answered Questions

[SOLVED] Cast int to enum in C#

  • 2008-08-27 03:58:21
  • lomaxx
  • 1059371 View
  • 2648 Score
  • 21 Answer
  • Tags:   c# enums casting

64 Answered Questions

[SOLVED] How do I calculate someone's age in C#?

  • 2008-07-31 23:40:59
  • Jeff Atwood
  • 491919 View
  • 1743 Score
  • 64 Answer
  • Tags:   c# .net datetime

9 Answered Questions

[SOLVED] What are the correct version numbers for C#?

21 Answered Questions

[SOLVED] How do you give a C# Auto-Property a default value?

296 Answered Questions

[SOLVED] Hidden Features of C#?

  • 2008-08-12 16:32:24
  • Serhat Ozgel
  • 627195 View
  • 1476 Score
  • 296 Answer
  • Tags:   c# hidden-features

Sponsored Content