473,382 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

error when loading the drop down list...

pls let me know where i am going wrong.

Dim categories As ArrayList

Private Sub LoadCategoryDropDownList()
Dim sCat As String
For Each sCat In categories ///pls see the error at the bottom of the
page.
ddlcat.Items.Add(sCat)
Next
End Sub

Public Shared Function GetCategories() As ArrayList
Dim stream As New FileStream("C:\saru\Categories.dat", FileMode.Open,
FileAccess.Read)

Dim reader As New BinaryReader(stream)
Dim sCat As String
Dim categories As ArrayList

Do Until reader.PeekChar <> -1
sCat = reader.ReadString
categories.Add(sCat)
Loop

reader.Close()
'categories.Sort() /// this line also i am getting error.
Return categories
End Function

Error:

Server Error in '/HalloweenStore' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.

Source Error:

Line 58: Private Sub LoadCategoryDropDownList()Line 59: Dim
sCat As StringLine 60: For Each sCat In categoriesLine 61:
ddlcat.Items.Add(sCat)Line 62: Next
Source File: c:\inetpub\wwwroot\HalloweenStore\Order.aspx.vb Line:
60

Thanks

Jan 23 '06 #1
1 1459
You are not creating a new instace of the list. You have to do something
like "New ArrayList()".

<zo****@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
pls let me know where i am going wrong.

Dim categories As ArrayList

Private Sub LoadCategoryDropDownList()
Dim sCat As String
For Each sCat In categories ///pls see the error at the bottom of the
page.
ddlcat.Items.Add(sCat)
Next
End Sub

Public Shared Function GetCategories() As ArrayList
Dim stream As New FileStream("C:\saru\Categories.dat", FileMode.Open,
FileAccess.Read)

Dim reader As New BinaryReader(stream)
Dim sCat As String
Dim categories As ArrayList

Do Until reader.PeekChar <> -1
sCat = reader.ReadString
categories.Add(sCat)
Loop

reader.Close()
'categories.Sort() /// this line also i am getting error.
Return categories
End Function

Error:

Server Error in '/HalloweenStore' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.

Source Error:

Line 58: Private Sub LoadCategoryDropDownList()Line 59: Dim
sCat As StringLine 60: For Each sCat In categoriesLine 61:
ddlcat.Items.Add(sCat)Line 62: Next
Source File: c:\inetpub\wwwroot\HalloweenStore\Order.aspx.vb Line:
60

Thanks

Jan 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Leigh | last post by:
I am building a data entry application using Java servlets. I had hoped to use drop down boxes to provide the user with data entry selections pulled from a database, but am now questioning, given...
1
by: Aaron Prohaska | last post by:
I'm having the problem with this drop down list on postback. For some reason both the ListItems get selected when I change the selected item. Using the code below I'm building the drop down list in...
7
by: Amit | last post by:
I have a very poorly written ASP.NET application that I need to maintain (why me?!!). One of the pages has a huge drop-down list that loads more than a 1000 items. Because of this the resulting...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
3
by: Rob Meade | last post by:
...does it matter which order? ie... I create a table/tablerow/tablecell, I then create a new update panel, I create a drop down list, I add list items to the drop down list, I then add the...
1
by: Valli | last post by:
HI, I have a drop down list in my aspx page. When the list1 value changes, a procedure GetList2Values ( onchange="GetList2Values ()" ) will get executed. Since the list2 contains a large number...
0
by: yosri2005 | last post by:
Hello, I'm sure many of you have seen the error message in the subject. I found quiet a few posts on the web regarding this issue, but the ones I saw mainly tackle this issue when you have a...
3
by: tceramesh | last post by:
Hi Friends, I Created one drop down menu by using CSS. It is perfect in Firefox but in IE it creates some problem. in the header section the drop down menu appear,, below that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.