Click here to Skip to main content
15,914,444 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Deleting a item from ComboBox.. Pin
Jose Lamas Rios30-Jun-05 19:20
Jose Lamas Rios30-Jun-05 19:20 
GeneralRe: Deleting a item from ComboBox.. Pin
Jack Puppy30-Jun-05 19:24
Jack Puppy30-Jun-05 19:24 
GeneralRe: Deleting a item from ComboBox.. Pin
mpallavi30-Jun-05 19:51
mpallavi30-Jun-05 19:51 
GeneralRe: Deleting a item from ComboBox.. Pin
ThatsAlok30-Jun-05 20:03
ThatsAlok30-Jun-05 20:03 
GeneralRe: Deleting a item from ComboBox.. Pin
Jose Lamas Rios30-Jun-05 20:13
Jose Lamas Rios30-Jun-05 20:13 
GeneralRe: Deleting a item from ComboBox.. Pin
ThatsAlok30-Jun-05 20:36
ThatsAlok30-Jun-05 20:36 
GeneralRe: Deleting a item from ComboBox.. Pin
mpallavi30-Jun-05 20:40
mpallavi30-Jun-05 20:40 
GeneralRe: Deleting a item from ComboBox.. Pin
ThatsAlok30-Jun-05 21:00
ThatsAlok30-Jun-05 21:00 
mpallavi wrote:
I am creating a temp file .. i want to write all the values in this file except for the current selection..
how do i go about this?


Let this variable m_arr of type CStringArray contain all the phone number present in combo box.
  <font color=#008000>// first get Phone Number to delete</font>
   CString szPhoneNo;

   int nIndex=m_combo.GetCurSel();
  if(nIndex!=CB_ERR)  <font color=#008000> //thanks to Mr. Rios :)</font>
 {
   m_combo.GetLBText(nIndex,szPhoneNo);
 }
else
  <font color=#008000> // no string to delete from file</font>
  return;


  <font color=#008000> // Open Temporary File</font>
 CString szTempPath;
 GetTempPath(szTempPath.GetBuffer(MAX_PATH),MAX_PATH);

  <font color=#008000> // release buffer get control of Path</font>
 szTempPath.ReleaseBuffer();

  <font color=#008000> //Include our File Name in path</font>
 szTempPath+=CString("temp.txt");

  <font color=#008000> // Now Open Text File</font>
 CStdioFile m_File;


 if(m_File.Open(szTempPath,CFile::modeCreate|CFile:modeWrite))
{

  for(int i=0;i<m_arr.GetUpperBound();i++)
  {
  <font color=#008000>   //copy data </font>
     if(m_arr.GetAt(i)!=szPhoneNo)
      m_File.WriteString(m_arr.GetAt(i));
   
  }
  
  m_File.Close();
}




"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


cheers,
Alok Gupta
GeneralRe: Deleting a item from ComboBox.. Pin
mpallavi30-Jun-05 21:20
mpallavi30-Jun-05 21:20 
GeneralRe: Deleting a item from ComboBox.. Pin
ThatsAlok30-Jun-05 21:28
ThatsAlok30-Jun-05 21:28 
GeneralRe: Deleting a item from ComboBox.. Pin
mpallavi30-Jun-05 22:26
mpallavi30-Jun-05 22:26 
GeneralRe: Deleting a item from ComboBox.. Pin
mpallavi1-Jul-05 1:44
mpallavi1-Jul-05 1:44 
GeneralRe: Deleting a item from ComboBox.. Pin
David Crow1-Jul-05 16:52
David Crow1-Jul-05 16:52 
GeneralRe: Deleting a item from ComboBox.. Pin
ThatsAlok1-Jul-05 18:39
ThatsAlok1-Jul-05 18:39 
QuestionHow to use the metafile DC in WIN32 API programming Pin
pradish30-Jun-05 18:47
pradish30-Jun-05 18:47 
AnswerRe: How to use the metafile DC in WIN32 API programming Pin
Jose Lamas Rios30-Jun-05 19:15
Jose Lamas Rios30-Jun-05 19:15 
GeneralRe: How to use the metafile DC in WIN32 API programming Pin
pradish30-Jun-05 20:07
pradish30-Jun-05 20:07 
GeneralRe: How to use the metafile DC in WIN32 API programming Pin
Jose Lamas Rios30-Jun-05 20:18
Jose Lamas Rios30-Jun-05 20:18 
QuestionHow to insert a &quot;,&quot; in an array? Pin
Member 199230330-Jun-05 15:27
Member 199230330-Jun-05 15:27 
AnswerRe: How to insert a &quot;,&quot; in an array? Pin
Christian Graus30-Jun-05 15:51
protectorChristian Graus30-Jun-05 15:51 
GeneralRe: How to insert a &quot;,&quot; in an array? Pin
Jose Lamas Rios30-Jun-05 16:22
Jose Lamas Rios30-Jun-05 16:22 
GeneralDialog Position Pin
Archer28230-Jun-05 14:21
Archer28230-Jun-05 14:21 
GeneralRe: Dialog Position Pin
David Crow30-Jun-05 17:03
David Crow30-Jun-05 17:03 
GeneralRe: Dialog Position Pin
flystar70730-Jun-05 20:13
flystar70730-Jun-05 20:13 
GeneralRe: Dialog Position Pin
Archer28230-Jun-05 20:19
Archer28230-Jun-05 20:19 

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.