C++ windows form breaks after input

program break after input int textbox ISBN i think its something to do with the mod11Function

//My Functions

bool blnDateFormatFunction (string strDate)
{

bool blnValidformat = false;

int intDay = stoi(strDate.substr(0, 2));
int intMonth = stoi(strDate.substr(3, 2));
int intYear = stoi(strDate.substr(6, 4));

if (strDate.length() == 10)
{
if (strDate[2] == strDate[strDate.find_first_of ('/')])
if (strDate[5] == strDate[strDate.find_last_of ('/')])
blnValidformat = true;

if ((strDate[0] && strDate[1] && strDate[3] && strDate[4] && strDate[6]
&& strDate[7] && strDate[8] && strDate[9]) == atoi(strDate.c_str()))
blnValidformat = true;
}
return blnValidformat;
}

bool blnMod11Func (string strISBM)
{
bool blnValidMod11 = false;
int intResult =0, intMuliplier = 1;

for (int index =13; index >0; index--)
{
strISBM = strISBM.substr(index-1,1);
intResult += atoi(strISBM.c_str()) * intMuliplier++;
}

if (intResult %11 ==0)
blnValidMod11 = true;

return blnValidMod11;
}

//My Main

private: System::Void btnSave_Click(System::Object^ sender, System::EventArgs^ e)
{
string strDate ="";
string strISBM ="";

if (tbISBM->Text == "")
MessageBox::Show ("Cannot leave this field empty!!");

else if (tbISBM->Text->Length !=13)
MessageBox::Show ("ISBM must have 13 digits!!");

else
{
for (int index =0; index <tbISBM->Text->Length; index++)
strISBM += tbISBM->Text[index];

if (!blnMod11Func (strISBM))
MessageBox::Show ("ISBM not Mod11!!");
}

for (int index =0; index <tbDate->Text->Length; index++)
strDate += tbDate->Text[index];

if (!blnDateFormatFunction (strDate))
MessageBox::Show ("Incorrect date format entered!!");


Topic archived. No new replies allowed.