Click here to Skip to main content
15,912,977 members
Home / Discussions / C#
   

C#

 
AnswerRe: Custom Control expandable property ordering. Pin
Martin#11-Jan-10 3:43
Martin#11-Jan-10 3:43 
GeneralRe: Custom Control expandable property ordering. Pin
OriginalGriff11-Jan-10 3:57
mveOriginalGriff11-Jan-10 3:57 
GeneralRe: Custom Control expandable property ordering. Pin
Martin#11-Jan-10 4:01
Martin#11-Jan-10 4:01 
QuestionMouse Wheel Scroll Pin
Pavan Navali11-Jan-10 0:44
Pavan Navali11-Jan-10 0:44 
AnswerRe: Mouse Wheel Scroll Pin
Covean11-Jan-10 1:35
Covean11-Jan-10 1:35 
AnswerRe: Mouse Wheel Scroll Pin
PIEBALDconsult11-Jan-10 3:52
mvePIEBALDconsult11-Jan-10 3:52 
QuestionLooping through XMLNodeList problem Pin
jamesc6910-Jan-10 23:32
jamesc6910-Jan-10 23:32 
AnswerRe: Looping through XMLNodeList problem Pin
Keith Barrow11-Jan-10 0:00
professionalKeith Barrow11-Jan-10 0:00 
The poblem is this bit of code:


jamesc69 wrote:
foreach (XmlNode objRNode in nodeRooms)
{
intRoomRQId = int.Parse(objRNode["RoomRQId"].InnerText);
strQuantity = objRNode["Quantity"].InnerText;
intNumAdults = int.Parse(objRNode["NumAdults"].InnerText);
}


It will set the 3 variables (intRoomRQId, strQuantity intNumAdults), move to the next node then, before you have done anything with them, re-set with the values from the next node. The code posted will always end up with the variables set to the value of the last node.

To fix this you either need to do whatever it is you need to do with the variables in the loop, or create an object to store the three variables, and maintain a List of these which can be iterated over later.

As a side note intRoomRQId, strQuantity and intNumAdults are poorly named, you shouldn't include the type in the variable identifier in C#, and fully named is better. This will improve the readability of your code. I suggest roomRequestId (or whatever RQ means), quantityand numberOfAdults

CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks

GeneralRe: Looping through XMLNodeList problem Pin
jamesc6911-Jan-10 0:05
jamesc6911-Jan-10 0:05 
GeneralRe: Looping through XMLNodeList problem [modified] Pin
Keith Barrow11-Jan-10 0:11
professionalKeith Barrow11-Jan-10 0:11 
GeneralRe: Looping through XMLNodeList problem Pin
jamesc6911-Jan-10 0:23
jamesc6911-Jan-10 0:23 
GeneralRe: Looping through XMLNodeList problem Pin
Luc Pattyn11-Jan-10 0:47
sitebuilderLuc Pattyn11-Jan-10 0:47 
GeneralRe: Looping through XMLNodeList problem Pin
Keith Barrow11-Jan-10 0:54
professionalKeith Barrow11-Jan-10 0:54 
GeneralRe: Looping through XMLNodeList problem Pin
jamesc6911-Jan-10 1:08
jamesc6911-Jan-10 1:08 
GeneralRe: Looping through XMLNodeList problem Pin
Keith Barrow11-Jan-10 1:35
professionalKeith Barrow11-Jan-10 1:35 
GeneralRe: Looping through XMLNodeList problem Pin
Luc Pattyn11-Jan-10 2:09
sitebuilderLuc Pattyn11-Jan-10 2:09 
GeneralRe: Looping through XMLNodeList problem Pin
Keith Barrow11-Jan-10 2:23
professionalKeith Barrow11-Jan-10 2:23 
GeneralRe: Looping through XMLNodeList problem Pin
jamesc6911-Jan-10 2:33
jamesc6911-Jan-10 2:33 
GeneralRe: Looping through XMLNodeList problem Pin
Keith Barrow11-Jan-10 3:00
professionalKeith Barrow11-Jan-10 3:00 
AnswerRe: Looping through XMLNodeList problem Pin
#realJSOP11-Jan-10 3:31
professional#realJSOP11-Jan-10 3:31 
QuestionHow do I get the location and size of the upper leftmost cell in a DataGridView? Pin
arnold_w10-Jan-10 22:25
arnold_w10-Jan-10 22:25 
AnswerRe: How do I get the location and size of the upper leftmost cell in a DataGridView? Pin
sanforjackass10-Jan-10 23:55
sanforjackass10-Jan-10 23:55 
GeneralRe: How do I get the location and size of the upper leftmost cell in a DataGridView? Pin
arnold_w11-Jan-10 0:02
arnold_w11-Jan-10 0:02 
Questionappending text Pin
Member 59031010-Jan-10 22:23
Member 59031010-Jan-10 22:23 
AnswerRe: appending text Pin
Nicholas Butler10-Jan-10 22:27
sitebuilderNicholas Butler10-Jan-10 22:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.