Click here to Skip to main content
15,943,233 members
Home / Discussions / C#
   

C#

 
GeneralRe: Typed datasets? Pin
RitchieRich22-Apr-08 3:19
RitchieRich22-Apr-08 3:19 
GeneralRe: Typed datasets? Pin
Not Active22-Apr-08 3:32
mentorNot Active22-Apr-08 3:32 
GeneralRe: Typed datasets? Pin
RitchieRich22-Apr-08 3:51
RitchieRich22-Apr-08 3:51 
QuestionTransfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual22-Apr-08 3:00
Nahual22-Apr-08 3:00 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Spacix One22-Apr-08 3:42
Spacix One22-Apr-08 3:42 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual22-Apr-08 5:01
Nahual22-Apr-08 5:01 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Spacix One22-Apr-08 7:44
Spacix One22-Apr-08 7:44 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual23-Apr-08 3:54
Nahual23-Apr-08 3:54 
Hello,
You are right I would need the VSTFO to program for Word persay, but I think there is a different (easier way) to achieve the same results using the "StreamReader". I got this code from someone else (don't know where it came from): (NOT coded by me ALL credits to the author)
The thing is to be able to search for multiple "words" or "code" and be able to replace just as the aforementioned word macro does.
  //Enter some text that you want to search and replace<br />
    string find = txtFind.Text; <br />
    int replaced = 0;<br />
<br />
    //Get all the files from the root directory filtered by a filter text.<br />
    string[] fileList = Directory.GetFiles(@"C:\text files", "*.txt", SearchOption.AllDirectories);<br />
<br />
    //Loop through each file, call the ReplaceText() method<br />
    //and replace the file if something was replaced.<br />
    foreach (string file in fileList)<br />
    {<br />
       StreamReader sr = new StreamReader(file);<br />
       string content = sr.ReadToEnd();<br />
       sr.Close();<br />
       <br />
       if(ReplaceText(ref content, txtFind.Text, txtReplace.Text, ref replaced))<br />
       {<br />
           StreamWriter sw = new StreamWriter(file);<br />
           sw.Write(content);<br />
           sw.Flush();<br />
           sw.Close();<br />
           //TODO: Add the files to a collection that were affected.<br />
       }               <br />
    }<br />
    MessageBox.Show("Total replacements = " + replaced);<br />
//code goes on and on...

GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual24-Apr-08 14:12
Nahual24-Apr-08 14:12 
Generalwordpad Pin
negar77722-Apr-08 2:59
negar77722-Apr-08 2:59 
GeneralRe: wordpad Pin
Pete O'Hanlon22-Apr-08 3:03
mvePete O'Hanlon22-Apr-08 3:03 
GeneralRe: wordpad Pin
phannon8622-Apr-08 3:11
professionalphannon8622-Apr-08 3:11 
GeneralRe: wordpad Pin
Spacix One22-Apr-08 3:14
Spacix One22-Apr-08 3:14 
GeneralRe: wordpad Pin
Reelix22-Apr-08 3:24
Reelix22-Apr-08 3:24 
GeneralRe: wordpad Pin
Spacix One22-Apr-08 3:33
Spacix One22-Apr-08 3:33 
GeneralRe: wordpad Pin
negar77722-Apr-08 4:04
negar77722-Apr-08 4:04 
GeneralRe: wordpad Pin
Reelix22-Apr-08 4:10
Reelix22-Apr-08 4:10 
GeneralRe: wordpad Pin
Reelix22-Apr-08 3:22
Reelix22-Apr-08 3:22 
GeneralFileSystemWatcher Pin
stancrm22-Apr-08 2:50
stancrm22-Apr-08 2:50 
GeneralRe: FileSystemWatcher Pin
Spacix One22-Apr-08 2:58
Spacix One22-Apr-08 2:58 
GeneralRe: FileSystemWatcher Pin
Not Active22-Apr-08 3:12
mentorNot Active22-Apr-08 3:12 
GeneralWaitOne method Pin
George_George22-Apr-08 2:41
George_George22-Apr-08 2:41 
GeneralRe: WaitOne method Pin
Mike Dimmick22-Apr-08 3:01
Mike Dimmick22-Apr-08 3:01 
GeneralRe: WaitOne method Pin
George_George22-Apr-08 3:15
George_George22-Apr-08 3:15 
QuestionHow to remove description at the bottom of PropertyGrid Pin
Varad_Rajan22-Apr-08 2:39
Varad_Rajan22-Apr-08 2:39 

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.