473,386 Members | 1,630 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,386 software developers and data experts.

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
'BusinessAreaDataSet.BusinessAreaTableDataTable.Fi ndByBusinessAreaID(int)'

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

BusinessAreaDataSet myBusinessAreaDataSet = new
BusinessAreaDataSet();

foreach(UserDataSet.UserListTableRow row in dataSet.UserListTable)
{

// access the business area details for this user
BusinessAreaDataSet.BusinessAreaTableRow baRow =
BusinessAreaDataSet.

BusinessAreaTableDataTable.FindByBusinessAreaID(ro w.BusinessAreaID);

// add the business area details to the the list
AddItem(baRow.BusinessAreaName, baRow.BusinessAreaID,
baRow.BusinessAreaEnabledFlag);

}
}

public BusinessAreaTableRow FindByBusinessAreaID(int BusinessAreaID)
{
return ((BusinessAreaTableRow)(this.Rows.Find(new object[]
{BusinessAreaID})));
}

Nov 15 '05 #1
1 4589
Hi,

Instead of

BusinessAreaTableDataTable.FindByBusinessAreaID(ro w.BusinessAreaID);

it should be

myBusinessAreaDataSet.BusinessAreaTable.FindByBusi nessAreaID(row.BusinessAre
aID);

since BusinessAreaTableDataTable is class declaration and not an instance of
it.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
"TdJ" <pl*********@list.com> wrote in message
news:O6**************@TK2MSFTNGP09.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 'BusinessAreaDataSet.BusinessAreaTableDataTable.Fi ndByBusinessAreaID(int)'

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

BusinessAreaDataSet myBusinessAreaDataSet = new
BusinessAreaDataSet();

foreach(UserDataSet.UserListTableRow row in dataSet.UserListTable)
{

// access the business area details for this user
BusinessAreaDataSet.BusinessAreaTableRow baRow =
BusinessAreaDataSet.

BusinessAreaTableDataTable.FindByBusinessAreaID(ro w.BusinessAreaID);

// add the business area details to the the list
AddItem(baRow.BusinessAreaName, baRow.BusinessAreaID,
baRow.BusinessAreaEnabledFlag);

}
}

public BusinessAreaTableRow FindByBusinessAreaID(int BusinessAreaID)
{
return ((BusinessAreaTableRow)(this.Rows.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
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...
2
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...
3
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
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...
7
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...
11
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... ...
2
by: Beffmans | last post by:
Hi When I run this code: using System; namespace DelegateProject { public delegate void MyDelegate(string s);
2
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.