Hi everyone,

I have a problem that kept poping up in debug mode at the closing bracket of a function. I've tested each line of code adding one by one and running through it. Once I added the last line in this snipet I started getting the Access violation error. If I run the code I on't get the error, only in debug mode.
Code:
	int radioState =0; 
	char location = 'N';
	FileBrowse ConnectFile;
	CString localfile;

	CInternetSession isession;

	CFtpConnection* pConnect = NULL;
	CString Server;

	if(location == 'L')
	{
		CMyFileDialog  FileDlg(TRUE,0,0,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,0,this);
	
		if(FileDlg.DoModal() == IDOK)
		{
			localfile = FileDlg.GetPathName();
			CEdit* pEditSelFile = (CEdit*)GetDlgItem(IDE_FILEPATH);
	        pEditSelFile->SetWindowText(localfile);
		}

		InBAF::SetLocation(location);
		return;
	}
	else
	{
		InBAF::SetLocation(location);
		InBAF::SetServerName(location);
		Server = InBAF::GetServerName();
	}

	pConnect = isession.GetFtpConnection(_T(Server));
		
	//CMyConnection::InitConnection(pConnect);
	
	pConnect->SetCurrentDirectory("recording:[000000]");
		CListBox* pListMain = (CListBox*)GetDlgItem(IDLB_MAINDIR); 
	CListBox* pListSub = (CListBox*)GetDlgItem(IDLB_SUBDIR);

	
	//clear the listbox with folders
	pListMain->ResetContent();
	pListSub->ResetContent();

	CFtpFileFind finder(pConnect);
	
	// Find  the first file 
	BOOL bWorking = finder.FindFile(_T("*"));
I'm not sure if there is something else that causes it, but before I put this line in I didn't get the access violation error. What access is the function violating?