QUOTE(Martyr2 @ 15 Nov, 2007 - 11:55 AM)

I am going to take a stab at this since I am not completely sure what first and last may exactly mean. But I think the problem is with your statement
last = last.next. First thing I want to point out is that if this is the last node, last.next will be null. Which is fine, but I wanted to make sure you knew that. What you need to do is get the reference to the node BEFORE the last and set its "next" to last.next. The idea is that the node before the node to be deleted will have to have its "next" pointer point to the one AFTER the node being deleted. In this case again, it will be null if this is the last element. So navigate to the node before the last node, lets call it secondtoLast and set it up like...
CODE
secondtoLast.next = last.next;
The image of this would look like so....

Hope that clarifies some things.
Enjoy!
"At DIC we be node changing code ninjas!"

Thanks Martyr2, that is a superb explanation of the way the next operator works. I actually got it figured out later on that morning so thanks are in order for all who replied...Thanks! I have another question though on the same program. I am trying to implement a "Search" operator that will iterate through the list and output the value in a given node based on input e.g. user types 5 and the program displays the value(element) in 5. I am having a problem calling it from my Main program. Also, shown below is code for an ObtainFirst and ObtainLast operators that will display elements in the first and last nodes, similar issue. Any suggestions?
Search, ObtainFirst & ObtainLast Methods:
CODE
public void Search(SinglyLinkedList list,
int nodeVal,
ref int nodeLocation)
{
int counter = 1;
Node current;
current = list.first;
while (current != null)
{
if (current.datum == nodeVal)
{
nodeLocation = counter;
}
current = current.next;
counter++;
}// while loop
}//method Search
/ ===============
// Method ObtainFirst:
// ========================================
public void ObtainFirst(ref int nodeVal)
{
nodeVal = first.datum;
}//method ObtainFirst
// =====================
// Method ObtainLast:
// ========================================
public void ObtainLast(ref int nodeVal)
{
nodeVal = last.datum;
}//method ObtainLast
// ====================
Main program (where I am trying to call them):
CODE
case 14:
UtilityMethods.CaseBanner("ObtainFirst.");
UtilityMethods.GetInteger(out nodeVal);
listA.ObtainFirst(ref nodeVal); // <------Issue here?
break;
case 15:
UtilityMethods.CaseBanner("ObtainLast.");
UtilityMethods.GetInteger(out nodeVal);
listA.ObtainLast(ref nodeVal); // <-------
break;
// =====================
case 24:
UtilityMethods.CaseBanner("Search List.");
UtilityMethods.GetInteger(out nodeVal);
listA.Search(); // <-------- <------What do I need to put here?
break;
The GetInteger Utility:
CODE
// ================================================
public static void GetInteger(out int intValue )
{
string intString;
Console.WriteLine();
Console.WriteLine("=======================");
Console.WriteLine("Enter an integer value.");
intString = Console.ReadLine();
intValue = int.Parse(intString);
Console.WriteLine("GetInteger terminating.");
Console.WriteLine("=======================");
Console.WriteLine();
} // method IterateAgain
// ========================
I hope this is sufficient, I didn't want to include ALL of the code again

Thanks!