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

Accessing Properties?

Hi

My code looks like the follwing:

namespace A.B.C
{
....
private void foo()
{
A.B.C.Properties.Settings.Default.Save();
Properties.Settings.Default.Save() //error
}
}

The error I'm getting is "Cannot access internal property "Properties"
here". Why not though? I thought I was in the correct namespace?

Shak
Oct 18 '06 #1
4 1723
Shak <me@privacy.netwrote:
My code looks like the follwing:

namespace A.B.C
{
...
private void foo()
{
A.B.C.Properties.Settings.Default.Save();
Properties.Settings.Default.Save() //error
}
}

The error I'm getting is "Cannot access internal property "Properties"
here". Why not though? I thought I was in the correct namespace?
Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 18 '06 #2
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
Shak <me@privacy.netwrote:
>My code looks like the follwing:

namespace A.B.C
{
...
private void foo()
{
A.B.C.Properties.Settings.Default.Save();
Properties.Settings.Default.Save() //error
}
}

The error I'm getting is "Cannot access internal property "Properties"
here". Why not though? I thought I was in the correct namespace?

Could you post a short but complete program which demonstrates the
problem?
Jon,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace proptest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
proptest.Properties.Settings.Default.Save();
Properties.Settings.Default.Save(); //red wavy line
}
}
}

This is a windows project that has been created from scratch from VS2005,
with a single setting added to the Settings.settings file, and the above
added to the formload event.

However, it now seems that this is only an "Intellisense" error, and the
file compiles fine and functions normally. It's still annoying though, so if
anyone knows why this is happening I'd appreciate it...

Shak
Oct 19 '06 #3
Shak <me@privacy.netwrote:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace proptest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
proptest.Properties.Settings.Default.Save();
Properties.Settings.Default.Save(); //red wavy line
}
}
}
That's not a complete program - you haven't shown the other part of the
partial class, or what the Properties class is.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 19 '06 #4
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
Shak <me@privacy.netwrote:
>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace proptest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
proptest.Properties.Settings.Default.Save();
Properties.Settings.Default.Save(); //red wavy line
}
}
}

That's not a complete program - you haven't shown the other part of the
partial class, or what the Properties class is.
Apologies, I presumed you didn't want the autogenerated stuff. But it's ok,
I'll live with the fussy intellisense for now. Thanks for the help anyway.

Shak

Shak
Oct 19 '06 #5

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

Similar topics

3
by: PW | last post by:
Hi, I'm using WinXP-Pro, ASP classic, IIS 5.0. I regularly get this error, but I know I am the only user accessing the website at the time of the error. I looked it up on the MS support...
1
by: Toufani | last post by:
Hi everybody, I want to retrieve information about objects in active directory windows 2000 and their properties. I got some codes that don't work absolutely. for example I can't retrieve users...
6
by: DKode | last post by:
Ok, kind of a silly question I just want to know what the proper method is, When I have local Properties, ie: private bool _someVal; public bool SomeVal { get { return _someVal; } }
3
by: Craig G | last post by:
i have a user control which is basically a datagrid, which has add/edit/delete buttons on the grid is there anyway of accessing the actual datagrid from the form itself? basically i want to...
6
by: arvee | last post by:
Is there a way to access controls (and their properties) in a user control? The Web Form Designer marks controls as 'Protected' which makes them inaccessable from the host form. If I mark them as...
8
by: Mike Caputo | last post by:
In VB.NET, need to be able to access certain properties on my main form from other forms. These are properties that may be changed by the user, so I have to be able to get to them throughout the...
8
by: dwok | last post by:
I have been wondering this for a while now. Suppose I have a class that contains some private member variables. How should I access the variables throughout the class? Should I use properties that...
5
by: Cyril Gupta | last post by:
Hello, I have a class inside another class. The Scenario is like Car->Engine, where Car is a class with a set of properties and methods and Engine is another class inside it with its own set of...
0
by: joshua.oconnor | last post by:
I am having a problem accessing the properties of a structure object returned from a webservice. The web service returns an object: changeobject.description changeobject.user I can create an...
15
by: Bob | last post by:
Is there anyway to access the global object from inside a function other than doing a "var _global = this;" before declaring the function? Thanks
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.