accessing objects within objects

I have a class, Computer. I have a hashtable full of classes that is within Computer. It is Categories (ie cpu, ram, etc).  I try to access my Category like this and it doesn't work. I am recently switching from ASP to ASP.NET/C# so vbscript was my only previous programming experience.

Computer myComputer = new Computer("tower2000");
// within the Computer constructor is when it creates the 30 or so categories
// of computer parts, as a hashtable and creating a new Category object for each
Category myCategory = (Category) myComputer.myCategories[0];
Label1.Text = myCategory.CategoryID;
// This causes an error. There is a property within each Category class that is CategoryID
// that gets set to the Category's ID upon constructor.
What am I doing wrong? Thank you, Bret.
0
thorium
10/15/2003 6:26:58 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

1 Replies
777 Views

Similar Articles

[PageSpeed] 34


Could you tell us what the error message says and also show us the [appropriate] code.

Steven Bey

Recursion: see Recursion
0
stevenbey
10/15/2003 12:42:06 PM
Reply:

Similar Artilces:

detailsview and objects (and objects inside objects inside objects)
hi there!as I was browsing through the posts related to the detailsview I couldn't find someone with the problem I'm facing so I decided to post here...well, I was able to bound an object datasource into my gridview and detailsview, it deletes and shows the data very well, BUT inside the object, there's another object, for example, I have bound a class called Province and inside the Province class there's the Country class indicating the data from the related country, to edit and/or insert I have placed a drop down list so the user selects the country from a drop down list, everything seems ...

move, access users visual objects within a visual user object
Hi everyone. I'd like to make a user visual object (uvo) like the DW SQL painter: some nvo placed in an other nvo with lines (links) between them. I don't know if any of you has developp something similar but I encountered several problems: I can't move (with mouse) nvo placed on another nvo (no moveable properties, no move events) I's like to make a planning object as you can see here http://www.handyarchive.com/free/chart/index7.html Is there a way to do thath in PB ? You are better off doing this using a datawindow and yes it HAS been done before.....

Property of an object within an object
How do I access the property of an object that is within another object? For example, I have an object consisting of an ArrayList of object. The objects contained in the ArrayList have the properties DisplayText and ValueText. What is the syntax to retrieve those properties? Here's the class file code: Public Class MenuOption Public DisplayText As String Public ValueText As String Public Sub New(DisplayText As String, ValueText As String) MyBase.New() Me.DisplayText = DisplayText Me.ValueText = ValueText End Sub En...

Deserializing An Object from within that object
I have an C# Class I can easily serialize into XML and desereilalize it. However, I want to do this from Inside the object. Here's a sample of my code that I used from the Code-behind: string strPackageListPath = Path + "\\test.xml"; if (System.IO.File.Exists(strPackageListPath)) { System.Xml.Serialization.XmlSerializer s = new System.Xml.Serialization.XmlSerializer(typeof(PackageList)); System.IO.TextReader tr = new System.IO.StreamReader(strPackageListPath); INSTANTIATED_OBJECT = (PackageList)s.Deserialize(tr); tr.Close(); } So, instead of using INSTANTIATED_OBJECT, It woul...

Creating objects within objects.
I have a friend who is trying to create a form on the fly with a pagecontrol, tabsheets and wants to add scrollbox and 3 images to each tabsheet. We cannot figure out why this does not work. Any idea's would be appreciated. Code is his but I have updated it with what little I know. ;-) Thanks. procedure TfGallery.btnBuildLayersClick(Sender: TObject); var im: TImage; ts: TTabSheet; sb: TScrollBox; i, j, iActLeft, iActTop : integer; begin //Create TabSheets & add Captions for i := 0 to 4 do begin ts := TTabSheet.Create(PageControl1); with ts do ...

error "Object reference not set to an instance of an object" when adding a new web form
hiya, i get the error "Object reference not set to an instance of an object" when adding a new web form to a web site this is what i am doing i launch vs 2005 beta 2 i create a new web site on the solutions explorer, i right click on the site and select "add new item" i select "web form" on the dialog box, and click "add" and that's when i get the error any ideas? f...

populating web form objects when using Visual Studio.NET
What is the best way of creating datasets for asp.net pages and populating web form objects. I have always created datasets within a sub routine and then populated my web form controls from that dataset. I was given some code that the pages were created in visual studio. I know the page gets its data from a stored procedure. What I can't find is code that calls that stored procedure and also populates the web form objects. Most of my asp.net development has been done on the asp.net page and not in Visual Studio. So if someone could tell me what to look for that would be great. Well, t...

Acessing variables, objects and functions from javascript to VB .NET Web Forms
I have included some javascript files in my vb.net application. I want to access the variables, objects and functions of Javascript to the VB.NET Web Forms, which means that I want to transfer the methods from Javascript to the code-behind in a web form. How do I do this? Can anybody help me with some sample codes...thanks in advance . you can't pass javascript variables (client side) to code-behind (server side). you can however put your variables into hidden input fields then access those input fields from code-behind. or use ajax I think the only way to do this is...

Accessing a method within a class VB.NET from a Web Form page.
 I got the following class within my App_Code folder under a file called DataAccess.vb: Namespace CircaComArtAccess Public Class ComArtData Private _connstr As String = System.Configuration.ConfigurationManager.ConnectionStrings("ESQLConn").ConnectionString() Public Sub ComArtGrid(ByVal procedurename As String, _ ByVal parameters() As SqlParameter, _ ByVal gridname As ComponentArt.Web.UI.Grid, _ ByVal e As ComponentArt.Web.UI.CallBackEventArgs, _ Optional ByVal commandtype As CommandType = 1 _ ) Dim SQLConn As SqlConnection...

Acessing variables,arrays, objects and functions from javascript to VB .NET Web Forms
I have a textbox where user can put data.I store data into an array .I did this with java script.now i want to acess the array from the Codebehind  in vb.net web pages.here is the codefunction MakeArray( n ) { if( n <= 0 ) { this.length = 0; return this; } this.length = n; for( var i = 1; i <= n; i++ ) { this[ i ] = 0; } return this; } var Form1 = new MakeArray( 25 ); var index = 0; var cmmnd = 1; function f_store( sTR ) { var i; if( index >= Form1.length ) { for( i = 1; i < Form1.length; i++ ) Form1[i-1] = Form1; index = Form1.length - 1; } Form1[ index ] = cmmnd + ":" + sT...

Accessing objects returned by COM object
Hello there, I'm new to ASP.NET (migrating from PHP and Java), and have what is probably an entirely stupid problem: The data layer of the site I am updating is composed of a number of compiled COM objects, the source of which I don't have access to. I have created Interop wrappers for the objects, but I'm not quite sure how to handle the VB objects that they return (I am working in C#). I'm not very familiar with VB, but the VB objects are definitely a list of some kind, so I was vaguely hoping to be able to cast to an ArrayList. Unfortunately, this is raising an IllegalCastExce...

Object to Object Initialization in C#.net
Hi, I want to Initialization the the base class object to derived class object. but it gives an error in c#.Net. It's works fine in VB.Net bt in c#.net dosn't work. what exactly i m doing as follows; class class1 { pubic int i; } class class2 : class1 { // some method .... } in the main function. static void main() { class1 c1 = new class1(); class c2; c2=c1; // this is  not workin in c#.net alougth it's woks fine in vb.net class c2 = new class1(); // i don't want  like this. is there any onther way in c# to acheive this. please help me.. }Sandeep...

accessing objects between forms???
hi. i am having a really hard time figuring this out... i have a form frm_newitem. in it are a number of input boxes with values input by the user (_subject, _location, etc). frm_newitem is loaded in frm_newitem.master (the master page) which also contains a control below the header that has a "save" and "cancel" button on it. The "save" button is meant to save the values input on the frm_newitem form. This poses a problem form me: How do i save the values when the save button is on a different form? I read a number of options: 1) session state objects 2) saving vals to a da...

Replace the .NET 1.1 Behavior-Object with the .NET 2.0 Tag-Object , How to?
Hello, to set the Style - Attribute of my custom controls tag in source view from within its designer i use now the following code:Behavior.SetStyleAttribute("Left", false, val, true);This works fine but my visual studio 2005 / asp.net 2.0 says that the Behavior object is obsolete. The recommended alternative is the Tag object. But when i use it to set the Style attribute it doesn't work . I can set all other attributes or even create new ones using this Tag object but it does'nt work for the style attribute at all. What am i doing wrong? If I can't set the style attribute in my custom contr...

Web resources about - accessing objects within objects - asp.net.web-forms

Highest Percentage Of Opera Mini Users Accessing Facebook? Macau
If you were asked to guess which country had the highest percentage of users of Opera mobile Web browser Opera Mini users accessing Facebook ...

International Users Accessing Facebook Places Through US VPN Accounts
By using a virtual private network (VPN) hosted in the United States, Facebook users from around the world are accessing Facebook Places. The ...

What are some alternatives to Yodlee for accessing bank information?
Clay Loveless , Founder, Jexy. Co-founder, Mashery. Founder, Jexy. Co-founder, Mashery.

Cloud Console - Accessing files in cloud storage for iPad on the iTunes App Store
Get Cloud Console - Accessing files in cloud storage on the App Store. See screenshots and ratings, and read customer reviews.

Meryl Streep On Accessing The Characters Within - YouTube
Meryl Streep talks about the importance of an actors work representing their ability. CONNECT WITH AFI: http://facebook.com/AmericanFilmInstitute ...

Accessing the Future Fund a sensible proposal, says super expert Daryl Dixon
As portfolios go, the Future Fund's asset allocation is concentrated in higher-risk investment, including equities and alternative assets.

Accessing my Super
I'm 57 - can I access my super?

Australia, US accessing Indonesian telephone data, leaked documents show
Newly disclosed documents from former US intelligence contractor Edward Snowden have revealed that Australian intelligence efforts against Indonesia ...

Euthanasia advocate Philip Nitschke detained at Melbourne Airport, accuses Customs officials of accessing ...
Euthanasia advocate Philip Nitschke has accused Customs officials of accessing hundreds of patients' sensitive records on his laptop after detaining ...

Frances Abbott scholarship: Sydney woman pleads guilty to accessing Whitehouse Institute records on PM's ...
A Sydney woman who leaked the student records of Tony Abbott's daughter pleads guilty. A Sydney woman who leaked the student records of Prime ...

Resources last updated: 1/20/2016 12:10:55 AM