Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to write program in vb.net to show following output in list box..
12345
1234
123
12
1
Posted
Comments
Krunal Rohit 22-Nov-15 2:41am    
Just add each of the items in listbox.
listbox1.Items.Add("1 2 3 4 5")
// same for the rest

-KR
[no name] 22-Nov-15 2:50am    
using for loop(nested loop)?

1 solution

That should be very easy to achieve if you would have tried.

Something like following should work-
VB
Dim _items As New List(Of String)()
Dim _items As New List(Of String)()
Dim maxvalue As Integer = 5

While maxvalue >= 1
	Dim tempstr As String = ""
	For i As Integer = 1 To maxvalue
		tempstr += i.ToString()
	Next
	_items.Add("tempstr")
	maxvalue -= 1
End While
listBox1.DataSource = _items


Hope, it helps :)
 
Share this answer
 
v2
Comments
Richard MacCutchan 22-Nov-15 3:21am    
You do not help people by doing their homework for them.
Suvendu Shekhar Giri 22-Nov-15 3:56am    
Agree. Haven't thought much before answering. Will keep in mind your suggestion. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900