473,586 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

default property ?

Compiler Error Message: BC30367: Class 'System.Web.Htt pContext' cannot be indexed because it has no default property.
how do I create a "default property" ??
Mar 15 '06 #1
2 3044
You don't create a default property of an existing class.

You probably want the "Items" property...with out having shown us any code,
my guess is that you want to do:

Context.Items(" BLAH")

Karl

--
http://www.openmymind.net/

"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
news:uZ******** *******@TK2MSFT NGP12.phx.gbl.. .
Compiler Error Message: BC30367: Class 'System.Web.Htt pContext' cannot be
indexed because it has no default property.
how do I create a "default property" ??

Mar 15 '06 #2
A default property is a property which is invoked when you use an indexer
without specifying the name of the property that takes an indexer. For
example, most Collections have a default property which allows you to
specify an item in the Collection via the following terminology:

SomeCollection[0] (C#)
SomeCollection( 0) (VB.Net)

I am not familiar with how this is declared in VB.Net, but to do so in C#,
you would create a default property something like the following:

public class foo
{
private StringCollectio n _Strings = new StringCollectio n();

public int this[int index]
{
get { return _Strings[index]; }
set { _String[index] = value; }
}
}

As you can see, the default property doesn't have to refer to the object
itself, but can be defined in any number of ways.

I would suspect that in your case, you possibly referenced:

....HttpContext[i]

or possibly

....HttpContext["foo"]

or possibly within a Page or other class having a System.Web.Http Context
member:

Context[i]

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
news:uZ******** *******@TK2MSFT NGP12.phx.gbl.. .
Compiler Error Message: BC30367: Class 'System.Web.Htt pContext' cannot be
indexed because it has no default property.
how do I create a "default property" ??

Mar 15 '06 #3

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

Similar topics

5
10215
by: Chuck Bowling | last post by:
Maybe I'm doing something wrong or just don't understand the concept, but i'm having a problem with default properties. My impression of how a default property should act is this; MyClass c = new MyClass(); c = "my text"; In the line above, the string is assigned to a field in the class instance.
3
6738
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the following default properties: Height = 32px, Width = 144px. I declare the Width property in my control as... \\\
15
12529
by: simonoficina | last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button object has a property called "default" that can set this button like press "ENTER" key. But in the VB.net I can't find this property. Where is it? Or mabye change the other thing,No?Thanks ! Simon
0
25532
ADezii
by: ADezii | last post by:
The motivation for this Tip was a question asked by one of our Resident Experts, FishVal. The question was: How to Declare Default Method/Property in a Class Module? My response to the question was inadequate to say the least, but I was determined to come up with the correct answer, especially since my primary background is Visual Basic, and I...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5710
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.