473,412 Members | 2,048 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,412 software developers and data experts.

return a collection from class

TJS
from a code class,
a] how does one dimension a collection and then
b] after it is created, reassign it in the page ?

I'm getting only errors on line of code in the page.
"System.NullReferenceException: Object variable or With block variable not
set "


example :
------------------
function buildmenu ()
dim mymenu as ??

[...code here...]

return mymenu
end function
in the page should this work to reassign menu collection??

<Script runat="server">
mymenu = myObject.Buildmenu () '<= errors here
....
</script>

<mycontrol:menu id="mymenu" runat="server">
Nov 18 '05 #1
3 1275
A Collection is a class, just like an Integer, String, or an Object.
Everything in .Net is a class. IOW, treat it like you would an Integer,
String, or Object.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"TJS" <no****@here.com> wrote in message
news:uN**************@TK2MSFTNGP15.phx.gbl...
from a code class,
a] how does one dimension a collection and then
b] after it is created, reassign it in the page ?

I'm getting only errors on line of code in the page.
"System.NullReferenceException: Object variable or With block variable not set "


example :
------------------
function buildmenu ()
dim mymenu as ??

[...code here...]

return mymenu
end function
in the page should this work to reassign menu collection??

<Script runat="server">
mymenu = myObject.Buildmenu () '<= errors here
...
</script>

<mycontrol:menu id="mymenu" runat="server">

Nov 18 '05 #2
TJS
I treated it as an object and it still returns the same error (?)
Nov 18 '05 #3
TJS
problem found -- late binding
Nov 18 '05 #4

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

Similar topics

0
by: David Elliott | last post by:
I am looking to use a field attribute in a to find and use a property. If given Find("Record Artist", "Billy Joel"); I am looking to find the first instance in the collection where the value the...
6
by: Whoever | last post by:
Here's what I have A custom collection: public class aUser { public string UserName { get {...} set {...} } public class UserList : System.Collection.CollectionBase { public void Add(aUser...
2
by: kermit | last post by:
I have a .net aspx page MyPage.aspx (client side) with code behind MyPage.aspx.vb (server side). I use the Page_Load event in MyPage.aspx.vb to load data into a multiteir class based...
7
by: nafri | last post by:
hello all, I want to create a function that returns the first element of the Array that is input to it. However, the Input Array can be an Array of points, double, or anyother type, which means...
1
by: Thomas D. | last post by:
Hello all, I'm using the IXmlSerializable interface for a project and encounter some problems when testing my webservice in a client application. I know this interface is undocumented and not...
2
by: Jayme Pechan | last post by:
Is there a simple way to return a COM enumeration interface from .NET? I am porting a C++ COM Object that has an enumeration interface containing the DISPID_NEWENUM and DISPID_VALUE properties and...
11
by: joey.powell | last post by:
Hello, I have a windows forms application (VS2005) where I need to do the following... 1. Startup with a main form. 2. Have the user to select a file and then bring up a second form modally...
10
by: Raj | last post by:
I need a VB function to return array of collections like Private Type Employee empname as string address as string salary as integer deptno as integer End Type dim employees() as Employee
2
by: Veloz | last post by:
Hi there My question is regarding how to best return "collections" from a method call. Should you return an actual object or an interesting/ appropriate interface of the object, to the caller?...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.