Isn't that what I told you yesterday. Sheesh.:rolleyes:
Printable View
Almost 100% of functions used return some sort of value...these usually indicate success or failure...these return values should ALWAYS be checked else you are assuming the function was successful...this is not a good thing..
Also you might want to lookup info on Hungarian notation...I'm sure there are many out there that don't use (or agree with) this but when you do programs with 100K++ lines of code it will make things much easier to understand the code after not working with it for a while...plus if you get into a group programming enviroment it will make things easier on all if naming consistency is used.
ed: All of the more senior members here are volunteers helping people with their programming problem(s) and have good intentions to resolve them as fast as possible...sometimes this requires faith on the part of the requestor to give the member the info they have asked for and not what the requesting party thinks they need. There are senior members here that dedicate a good portion of their day helping people here and have well in excess of 10,000 post...most of them being answers to posted questions.
We also understand that you are having a problem that needs to be solved RIGHT NOW and that can/will be stressful...but you should also understand that it might take a little time to get an answer since the member with the solution might not be in the same time zone, country or even hemisphere as you...Of course that is just my opinion, I could be wrong.
Code:int iRetValue = LB_ERR;
iRetValue = m_Home.GetCurSel();
// Hungarian notation for the above
// iRetValue = m_lbHome.GetCurSel();
if(iRetValue != LB_ERR)
{
m_Home.GetText(iRetValue, m_Hsel);
// Hungarian notation for the above
// m_lbHome.GetText(iRetValue, m_csHsel);
// m_lbHome is a member variable to a ListBox
// m_csHsel is a member variable to a CString
}
else
{
AfxMessageBox("Item Not Selected for Hsel");
// if this is in a function the return your own error code
// with something like return(FALSE)/return(TRUE)
// and check all return values even from you own functions.
return;
}
Its obvious, I'm not an advanced programmer as you guys are so I apologize for my lack of knowledge. I'm primarily a SAS programmer so I tend to program what makes sense to me although I understand when requesting help its difficult for the person trying to help you debug your code.
Again, thanks to everybody's help and I apolgize if I offended anybody due to improper programming etiquette. Code Guru has always been a valuable resource and you guys go out of your way to help people which is pretty cool!!!