How can I clean (delete all entries) in a listbox on a form?
I am programming with Visual C# .NET.
Thanks for all your help in advance!
How can I clean (delete all entries) in a listbox on a form?
I am programming with Visual C# .NET.
Thanks for all your help in advance!
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
If you're actually looking for a winapi solution then LB_RESETCONTENT is the message for you.
Otherwise, please direct your questions to the proper (c# board) board.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
No, I am looking for .NET solution...
Anyway - isn't Windows Programming board board for any Windows Programming (from Win32 API to .NET Framework - Windows.Forms) ?
Can moderator please move this topic to C# board?
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
I fired up the .NET documentation and used the index to go to ListBox class (System.Windows.Forms). There was no obvious clear method defined directly on the ListBox class, so I looked for an Items property. Sure enough, the ListBox class has an Items property which returns a ListBox.ObjectCollection object. One of the methods availabe on this class is Clear. So, in the end, we get:
Code:listbox1.Items.Clear()
Thanks!
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL