I have written the followin two classes in mY BLL:
|
The above two classse are within the same namesapce BLL
then i tried to access the members of ItemStockLevel from the reference myIventoryItem.MyItemStockLevels from my client app as:
using BLL:
public class Form{
private void btnSave_Click(object sender, EventArgs e)
{
myIventoryItem._MyItemStockLevel.StockTakeDate = int.Parse(cmbStockTakeDate.Text);
byte scode = myIventoryItem.Save();
}
}
the line :
myIventoryItem._MyItemStockLevel.StockTakeDate = int.Parse(cmbStockTakeDate.Text);
gives the followig error
Error 1 'ICSBLL.InventoryItem' does not contain a definition for '_MyItemStockLevel' and no extension method '_MyItemStockLevel' accepting a first argument of type 'ICSBLL.InventoryItem' could be found (are you missing a using directive or an assembly reference?) F:\C#\Lab\InventoryControlSystem\InventoryControlSystem\frmInventoryItemAdmin.cs 60 36 InventoryControlSystem
Why this happense and how do i fix this?
petre ricardoPosted Mar 9, 2010, 8:08 PM
you program compiles well : ) at follows the pattern of my buggy pogram but it doesnt show any issues, but in my program it's areally annoying pain in back side issue that i cannot see where problem is... any way before the link to the code i would like state all the things that i have done:
1. each time when sit i reopn the VS, but it didnt fx the problem
2. i cant see any issus with namespace, sam hobs sample app follows the same pattern but tt doesnt give any error
3. when i remove the lines that gives error it builds. But i need those lines so that i could assign values to ItemStockLevel object
4.I'v tried re typing, it even shows the reference variables _MyItemStockLevel under insellisense it even show the members of ItemStocklevel under _MyItemStockLevel but when i assign a value with the correct type it gives the issue
here is link to the complete code http://www.mediafire.com/?hm0ywwzjzym
thanks
Sam HobbsPosted Mar 9, 2010, 4:41 PM
Amit ChoudharyPosted Mar 9, 2010, 2:59 AM
i don't think you can set the value of a class member using its object in another class and accessing it like the member. Try the following
code your problem will get solved
and your line should be like thisHope it helps you.
Please Don't forget to mark as answer if it helps you.