Click here to Skip to main content
15,909,741 members
Home / Discussions / C#
   

C#

 
GeneralRe: Adding DLL reference in runtime Pin
Ravi Bhavnani9-Feb-06 5:03
professionalRavi Bhavnani9-Feb-06 5:03 
QuestionOledb Provider giving error for opening DBF file using C#.NET Pin
Anil Dhiman8-Feb-06 23:23
Anil Dhiman8-Feb-06 23:23 
QuestionSave new RIch Text Box function Pin
TheNewNewGuy8-Feb-06 22:55
TheNewNewGuy8-Feb-06 22:55 
AnswerRe: Save new RIch Text Box function Pin
Ingo8-Feb-06 23:36
Ingo8-Feb-06 23:36 
QuestionXML convert to HTML Pin
JacquesDP8-Feb-06 22:50
JacquesDP8-Feb-06 22:50 
QuestionDatagrid Problem Pin
Anil Dhiman8-Feb-06 22:38
Anil Dhiman8-Feb-06 22:38 
AnswerRe: Datagrid Problem Pin
microsoc8-Feb-06 23:21
microsoc8-Feb-06 23:21 
GeneralRe: Datagrid Problem Pin
Anil Dhiman9-Feb-06 0:14
Anil Dhiman9-Feb-06 0:14 
GeneralRe: Datagrid Problem Pin
microsoc9-Feb-06 0:15
microsoc9-Feb-06 0:15 
QuestionHow to get RGB values from image file Pin
nps_ltv8-Feb-06 22:27
nps_ltv8-Feb-06 22:27 
AnswerRe: How to get RGB values from image file Pin
jinzhecheng9-Feb-06 16:43
jinzhecheng9-Feb-06 16:43 
QuestionAssigning a handle to a structrue Pin
Stefan Venter8-Feb-06 21:13
Stefan Venter8-Feb-06 21:13 
AnswerRe: Assigning a handle to a structrue Pin
[Marc]9-Feb-06 5:10
[Marc]9-Feb-06 5:10 
QuestionStopping/canceling a running database query Pin
Robert Rohde8-Feb-06 18:58
Robert Rohde8-Feb-06 18:58 
AnswerRe: Stopping/canceling a running database query Pin
J4amieC8-Feb-06 22:03
J4amieC8-Feb-06 22:03 
GeneralRe: Stopping/canceling a running database query Pin
Robert Rohde9-Feb-06 0:05
Robert Rohde9-Feb-06 0:05 
Questionhow can i read a .DAT file and convert it into proper text format ? Pin
geek-age8-Feb-06 18:25
geek-age8-Feb-06 18:25 
AnswerRe: how can i read a .DAT file and convert it into proper text format ? Pin
DigitalKing8-Feb-06 18:58
DigitalKing8-Feb-06 18:58 
Open the file with a FileStream object, then read the data into a byte array.
Use System.Text.Encoding.ASCII.GetString to convert the byte array into a string.
Then write the string to a file.
using System.Text;
using System.IO;

...

public static void Convert(string infile, string outfile)
{
    //If the file does not exist, throw an exception.
    if (!File.Exists(infile)) throw new FileNotFoundException();
    
    //Open the file with a FileStream object
    FileStream fs = new FileStream(infile, FileMode.Open);

    //Create a byte[] the same size as the file
    byte[] bytes = new byte[fs.Length];

    //Read the bytes from the FileStream object into the byte array
    fs.Read(bytes, 0, fs.Length);

    //Close and get rid of the FileStream
    fs.Close();
    fs.Dispose();

    //Convert the byte[] to a string
    string str = Encoding.ASCII.GetString(bytes);

    //Write the string to a file
    TextWriter t = new StreamWriter(outfile);
    t.Write(str);
    t.Flush();
    t.Close();
    t.Dispose();
}
Hope this helps,
DigitalKing
GeneralRe: how can i read a .DAT file and convert it into proper text format ? Pin
geek-age8-Feb-06 20:22
geek-age8-Feb-06 20:22 
Questioncursors problem Pin
edel_ong8-Feb-06 18:16
edel_ong8-Feb-06 18:16 
AnswerRe: cursors problem Pin
Robert Rohde8-Feb-06 18:49
Robert Rohde8-Feb-06 18:49 
GeneralRe: cursors problem Pin
edel_ong8-Feb-06 19:06
edel_ong8-Feb-06 19:06 
AnswerRe: cursors problem Pin
DigitalKing8-Feb-06 19:20
DigitalKing8-Feb-06 19:20 
Questionthis.close not working as expected Pin
TheJudeDude8-Feb-06 17:24
TheJudeDude8-Feb-06 17:24 
AnswerRe: this.close not working as expected Pin
Robert Rohde8-Feb-06 20:29
Robert Rohde8-Feb-06 20:29 

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.