473,804 Members | 3,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: object reference is required for the nonstatic field

TdJ
No end of reading on the net and I can not get this to compile! The error
message is:

An object reference is required for the nonstatic field, method, or property
'BusinessAreaDa taSet.BusinessA reaTableDataTab le.FindByBusine ssAreaID(int)'

Could someone explain to me what I am missing ... I wish to understand why
this isn't working
public DescListLookup( UserDataSet dataSet)
{
_enabledDisplay List = new ListItemCollect ion();
_allDisplayList = new ListItemCollect ion();

BusinessAreaDat aSet myBusinessAreaD ataSet = new
BusinessAreaDat aSet();

foreach(UserDat aSet.UserListTa bleRow row in dataSet.UserLis tTable)
{

// access the business area details for this user
BusinessAreaDat aSet.BusinessAr eaTableRow baRow =
BusinessAreaDat aSet.

BusinessAreaTab leDataTable.Fin dByBusinessArea ID(row.Business AreaID);

// add the business area details to the the list
AddItem(baRow.B usinessAreaName , baRow.BusinessA reaID,
baRow.BusinessA reaEnabledFlag) ;

}
}

public BusinessAreaTab leRow FindByBusinessA reaID(int BusinessAreaID)
{
return ((BusinessAreaT ableRow)(this.R ows.Find(new object[]
{BusinessAreaID })));
}

Nov 15 '05 #1
1 4615
Hi,

Instead of

BusinessAreaTab leDataTable.Fin dByBusinessArea ID(row.Business AreaID);

it should be

myBusinessAreaD ataSet.Business AreaTable.FindB yBusinessAreaID (row.BusinessAr e
aID);

since BusinessAreaTab leDataTable is class declaration and not an instance of
it.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
"TdJ" <pl*********@li st.com> wrote in message
news:O6******** ******@TK2MSFTN GP09.phx.gbl...
No end of reading on the net and I can not get this to compile! The error
message is:

An object reference is required for the nonstatic field, method, or property 'BusinessAreaDa taSet.BusinessA reaTableDataTab le.FindByBusine ssAreaID(int)'

Could someone explain to me what I am missing ... I wish to understand why
this isn't working
public DescListLookup( UserDataSet dataSet)
{
_enabledDisplay List = new ListItemCollect ion();
_allDisplayList = new ListItemCollect ion();

BusinessAreaDat aSet myBusinessAreaD ataSet = new
BusinessAreaDat aSet();

foreach(UserDat aSet.UserListTa bleRow row in dataSet.UserLis tTable)
{

// access the business area details for this user
BusinessAreaDat aSet.BusinessAr eaTableRow baRow =
BusinessAreaDat aSet.

BusinessAreaTab leDataTable.Fin dByBusinessArea ID(row.Business AreaID);

// add the business area details to the the list
AddItem(baRow.B usinessAreaName , baRow.BusinessA reaID,
baRow.BusinessA reaEnabledFlag) ;

}
}

public BusinessAreaTab leRow FindByBusinessA reaID(int BusinessAreaID)
{
return ((BusinessAreaT ableRow)(this.R ows.Find(new object[]
{BusinessAreaID })));
}

Nov 15 '05 #2

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

Similar topics

6
3921
by: Andrew Mueller | last post by:
Hello all, I am working on a project, converting code from VB 6.0 to C#. I have a COM object (SDK.dll) referenced and am having some issues using it. I don't think it is specific to the object as much as it is specific to how either C# or the CLR allows the use of different parameters and variables... This is just a guess. Anyway, here is the problem: In VB:
2
3830
by: DC | last post by:
I have created the following abstract class: public abstract class BaseC { protected int _ID; protected string _name; protected abstract DataTable GetData(int ID); // intended to hit data access layer
3
1617
by: Norman | last post by:
I have a collection that can have a reference to various types of arrays. String was easy: ... string sPropertyArray = (string)oReturn; foreach( string sItem in sPropertyArray ) { ...
5
2405
by: Peter | last post by:
Hi, I have a COM object in a dll and it is registered on the system. The COM object was made with Borland C++ Builder and works nicely when used in BC++ projects. I'm TOTALLY new to .NET (first day) and I have no clue how to use make use of the COM object. I made a small test app with a button and now I'm stuck ;-))
7
1341
by: Chris | last post by:
Hi, I am writing a webpage in C#. Visual Studio .NET. the following code does not provide me with intellisence on the context, session, and page.cache. When I put the large if...then statment from the GetJSHyperlinksString() function into the private void on page load event the intellisence works fine.
11
1614
by: dhnriverside | last post by:
Hi peeps Ok, so I thought I'd have a go at making a console app in VS2k5... I haven't written any windows apps for years, let alone dos apps (been web programming) and I've hit a dumb error... "An object reference is required for the nonstatic field, method or property " This is occuring in my main function...
2
11247
by: Beffmans | last post by:
Hi When I run this code: using System; namespace DelegateProject { public delegate void MyDelegate(string s);
2
8579
by: simonZ | last post by:
I have class, which returns dataTable to populate my list box on some other pages: public class dataClass { private Int16 _lvlRights=1 public static DataTable dtAdv() {
4
2562
by: cppquester | last post by:
I have a data set MMSDataAccess with: public partial class MMSDataSet : System.Data.DataSet { ... private TB_ACTHEATDATADataTable tableTB_ACTHEATDATA; ...
0
10326
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
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
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.