Problem in loop logic!

This is a discussion on Problem in loop logic! within the C++ Programming forums, part of the General Programming Boards category; Hi I am working on symbian os...m trying to validate email written in textbox. For first two times that gives ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    11

    Question Problem in loop logic!

    Hi
    I am working on symbian os...m trying to validate email written in textbox.
    For first two times that gives expected result but 3rd time application closes..
    my code for tat is like below:

    Code:
    TBool CformappDialog::ValidateInput()
        {
         
       // emailEdwin = static_cast<CEikEdwin*>(ControlOrNull(EformappEmail));
       // emailEdwin->GetText(iEmail);
        CEikEdwin* tmp = (CEikEdwin*)Control(EformappEmail);
        tmp->GetText(iEmail);
        
        _LIT( KAt, "@" );
        _LIT(MAt,".");
        TBool isValid = EFalse;
        TInt index  = iEmail.Find( KAt );
        
       
        if( KErrNotFound != index )
            {
    	    if ( iEmail.Length() > ++index )
    	        {
    	        // iEmailEnd contains email address from @ to end.
    	        iEmailEnd = iEmail.MidTPtr( index );
    	    
    	        // Search for @ is performed again.
    	        if ( iEmailEnd.Find(KAt) == KErrNotFound )
    	            {
    	            	TInt index1 = iEmailEnd.Find(MAt);
    	            	if(KErrNotFound != index1)
    	            	{
    	            		if(iEmailEnd.Length() > ++index1 )
    	            		{
    	            			if ( iEmailEnd1.Find(MAt) == KErrNotFound )
    	            			isValid = ETrue;
    	            		}
    	            	}
    	              }
    	         }
            else
                {
                isValid = EFalse;
                }
            }    
         
        return isValid;
        }
    Regards,
    Symbee
    Last edited by symbee; 11-09-2006 at 12:41 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Addition problem in loop
    By murjax in forum C Programming
    Replies: 3
    Last Post: 07-01-2009, 06:29 PM
  2. validation problem in a loop (newbie question)
    By Aisthesis in forum C++ Programming
    Replies: 11
    Last Post: 05-10-2009, 10:47 PM
  3. Logic problem
    By earth_angel in forum C Programming
    Replies: 6
    Last Post: 07-26-2005, 03:01 AM
  4. Stupid Logic Problem Need Outside Viewpoint
    By RP319 in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2005, 09:59 PM
  5. While loop problem
    By nadkingcole in forum C Programming
    Replies: 2
    Last Post: 05-09-2002, 06:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21