Click here to Skip to main content
15,889,992 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to update a richtextbox faster? Pin
James T. Johnson14-Mar-03 18:13
James T. Johnson14-Mar-03 18:13 
GeneralVS. NET bug Pin
Antoine Dubuc14-Mar-03 6:54
Antoine Dubuc14-Mar-03 6:54 
GeneralCustom Calender Pin
Mazdak14-Mar-03 5:19
Mazdak14-Mar-03 5:19 
GeneralRe: Custom Calender Pin
Paresh Gheewala28-May-03 10:58
Paresh Gheewala28-May-03 10:58 
Generalchecking the children of a node in a TreeView Pin
se99ts14-Mar-03 2:14
se99ts14-Mar-03 2:14 
GeneralFixed Pin
se99ts14-Mar-03 4:45
se99ts14-Mar-03 4:45 
GeneralRe: checking the children of a node in a TreeView Pin
Paresh Gheewala28-May-03 11:00
Paresh Gheewala28-May-03 11:00 
GeneralOpenFileDialog type in C# Pin
Member Salamon14-Mar-03 0:25
Member Salamon14-Mar-03 0:25 
OpenFileDialog type:

I am trying to send Intel hex file to target memory to one of my hardware .
I add (buttonOpenFile) in one of my application to send a file (SendFile) .
The code look like one below.

public void SendFile(FileStream fs)

{

byte[] buffer = new byte[fs.Length];

fs.Read(buffer, 0, (int)fs.Length);

Send(buffer);

}

Now I put the following in my button click handler:

private void buttonOpen_Click(object sender, System.EventArgs e)
{

FileStream fileh = new FileStream(@"C:\Skole\p01.hex", FileMode.Open, FileAccess.Read);

BaseTerm.term.SendFile(fileh);
fileh.Close();

}
The above code work without any problem, but I wish to create an instance of System.Windows .Form OpenFileDialog type
to return a Stream that represents the specified file selected by the user.

--------------------------------------------------------------------------------------
I tried to write the code to do the job, but I do not know how to write the last pieces of code.
I will be grateful if you could help me.

private void buttonOpen_Click(object sender, System.EventArgs e)
{

OpenFileDialog myOpenFileDialog = new OpenFileDialog();
myOpenFileDialog.InitialDirectory = "c:\\Skole\\" ;
myOpenFileDialog.Filter = "hex files (*.hex)|*.hex|All files (*.*)|*.*" ;
myOpenFileDialog.FilterIndex = 1 ;

myOpenFileDialog.RestoreDirectory = true ;

if(myOpenFileDialog.ShowDialog() == DialogResult.OK)
{

Stream myStream = null;
if(( myStream = myOpenFileDialog.OpenFile()) != null)
{

??????????
??????????


}

}
}

Salam Hamid

GeneralRe: OpenFileDialog type in C# Pin
John Fisher14-Mar-03 7:30
John Fisher14-Mar-03 7:30 
GeneralRe: OpenFileDialog type in C# Pin
Member Salamon18-Mar-03 12:21
Member Salamon18-Mar-03 12:21 
QuestionHow to Paste Metafile(GIF) from EXCEL Pin
tzn14-Mar-03 0:04
tzn14-Mar-03 0:04 
GeneralSome program designing problems Pin
Don Miguel13-Mar-03 23:46
Don Miguel13-Mar-03 23:46 
GeneralRe: Some program designing problems Pin
John Fisher14-Mar-03 7:27
John Fisher14-Mar-03 7:27 
GeneralRe: Some program designing problems Pin
Don Miguel14-Mar-03 23:56
Don Miguel14-Mar-03 23:56 
GeneralRe: Some program designing problems Pin
John Fisher15-Mar-03 14:48
John Fisher15-Mar-03 14:48 
GeneralRe: Some program designing problems Pin
Don Miguel2-May-06 1:16
Don Miguel2-May-06 1:16 
Questionwhy can not place a transparent panel on mediaplayer? Pin
henrykao13-Mar-03 20:27
henrykao13-Mar-03 20:27 
GeneralPrinting and DataBind issue Pin
Jack Hui13-Mar-03 20:00
Jack Hui13-Mar-03 20:00 
QuestionBasic Auth in ASP.NET? Pin
Adrian Hall13-Mar-03 19:13
Adrian Hall13-Mar-03 19:13 
Generalabout 'new form' Pin
cg112013-Mar-03 17:50
cg112013-Mar-03 17:50 
GeneralRe: about 'new form' Pin
Danny Blanchard14-Mar-03 8:33
Danny Blanchard14-Mar-03 8:33 
GeneralCompiling Entire ASP.NET C# Web Application from CommandLine csc.exe Pin
Vasudevan Deepak Kumar13-Mar-03 17:40
Vasudevan Deepak Kumar13-Mar-03 17:40 
GeneralUpdating a database Pin
Baatezu_Not_Home13-Mar-03 14:46
sussBaatezu_Not_Home13-Mar-03 14:46 
GeneralRe: Updating a database Pin
Mazdak14-Mar-03 5:34
Mazdak14-Mar-03 5:34 
QuestionJavascript communication with System.Form? Pin
Bog13-Mar-03 10:45
Bog13-Mar-03 10:45 

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.