Error !Object reference not set to an instance of an object. !!! Help

P

Parthiv Joshi

I am getting this error when I am trying to create a listbox of 7
textbox values on my page..In below code ( dateone to dateseven are
label controls )..I want to collect the values of these label controls
when the page executes..but I am getting above error...

Dim weekdayslist As ListBox
weekdayslist.Items.Add("dateone")
weekdayslist.Items.Add("datetwo")
weekdayslist.Items.Add("datethree")
weekdayslist.Items.Add("datefour")
weekdayslist.Items.Add("datefive")
weekdayslist.Items.Add("datesix")
weekdayslist.Items.Add("dateseven")

For i As Int32 = 0 To weekdayslist.Items.Count - 1
weekdayslist.Items(i).Selected = True
lblErr.Text = weekdayslist.SelectedItem.Value &
"<br>"
Next
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Parthiv Joshi) scripsit:
I am getting this error when I am trying to create a listbox of 7
textbox values on my page..In below code ( dateone to dateseven are
label controls )..I want to collect the values of these label controls
when the page executes..but I am getting above error...

Dim weekdayslist As ListBox

.... 'As New ListBox()'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top