Click here to Skip to main content
15,175,733 members
Home / Discussions / C#
   

C#

 
QuestionThe API Pin
mauricemcse17-Sep-12 11:32
Membermauricemcse17-Sep-12 11:32 
AnswerRe: The API Pin
Andrei Straut17-Sep-12 11:49
MemberAndrei Straut17-Sep-12 11:49 
AnswerRe: The API Pin
Mycroft Holmes17-Sep-12 21:18
professionalMycroft Holmes17-Sep-12 21:18 
GeneralRe: The API Pin
Andrei Straut17-Sep-12 21:26
MemberAndrei Straut17-Sep-12 21:26 
AnswerRe: The API Pin
V.17-Sep-12 21:30
professionalV.17-Sep-12 21:30 
AnswerRe: The API Pin
Pete O'Hanlon17-Sep-12 23:26
mvaPete O'Hanlon17-Sep-12 23:26 
AnswerRe: The API Pin
Richard MacCutchan17-Sep-12 23:41
mveRichard MacCutchan17-Sep-12 23:41 
QuestionC# access a file Pin
classy_dog17-Sep-12 9:37
Memberclassy_dog17-Sep-12 9:37 
In a C# 2008 desktiop application, I have a line of code that fails a try catch block.

The line of code is:
System.IO.FileStream fileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);

The wholse section of code looks like:
  public Attachment AttIputDoc(String custId, String fileName)
        {

           Attachment att = new Attachment();
            byte[] buffer = null;
            try
System.IO.FileStream fileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
catch (Exception e)
    {
    }

The line of code is trying to access a file that does not exist in a specific location.

Can you tell me how the code listed above knows where the directory path is for the file that needs to get uploaded at? The place it thinks the file needs to be loaded from is where the source code of where the application is acutally running from.

How would I override the default location so I can obtain the value from the app.config file?
AnswerRe: C# access a file Pin
Pete O'Hanlon17-Sep-12 10:01
mvaPete O'Hanlon17-Sep-12 10:01 
GeneralRe: C# access a file Pin
classy_dog17-Sep-12 18:02
Memberclassy_dog17-Sep-12 18:02 
GeneralRe: C# access a file Pin
Pete O'Hanlon17-Sep-12 23:05
mvaPete O'Hanlon17-Sep-12 23:05 
AnswerRe: C# access a file Pin
PIEBALDconsult17-Sep-12 18:00
professionalPIEBALDconsult17-Sep-12 18:00 
QuestionInternal connection fatal error!! why?!! Pin
Jassim Rahma17-Sep-12 6:12
MemberJassim Rahma17-Sep-12 6:12 
AnswerRe: Internal connection fatal error!! why?!! Pin
Pete O'Hanlon17-Sep-12 7:09
mvaPete O'Hanlon17-Sep-12 7:09 
GeneralRe: Internal connection fatal error!! why?!! Pin
Andrei Straut17-Sep-12 7:14
MemberAndrei Straut17-Sep-12 7:14 
AnswerRe: Internal connection fatal error!! why?!! Pin
Emmanuel Medina17-Sep-12 8:43
professionalEmmanuel Medina17-Sep-12 8:43 
GeneralRe: Internal connection fatal error!! why?!! Pin
Jassim Rahma17-Sep-12 8:56
MemberJassim Rahma17-Sep-12 8:56 
GeneralRe: Internal connection fatal error!! why?!! Pin
Emmanuel Medina17-Sep-12 9:12
professionalEmmanuel Medina17-Sep-12 9:12 
GeneralRe: Internal connection fatal error!! why?!! Pin
Jassim Rahma17-Sep-12 9:18
MemberJassim Rahma17-Sep-12 9:18 
GeneralRe: Internal connection fatal error!! why?!! Pin
Andrei Straut17-Sep-12 9:25
MemberAndrei Straut17-Sep-12 9:25 
GeneralRe: Internal connection fatal error!! why?!! Pin
PIEBALDconsult17-Sep-12 9:42
professionalPIEBALDconsult17-Sep-12 9:42 
AnswerRe: Internal connection fatal error!! why?!! Pin
PIEBALDconsult17-Sep-12 9:39
professionalPIEBALDconsult17-Sep-12 9:39 
AnswerRe: Internal connection fatal error!! why?!! Pin
jschell17-Sep-12 9:43
Memberjschell17-Sep-12 9:43 
AnswerRe: Internal connection fatal error!! why?!! Pin
Pete O'Hanlon17-Sep-12 10:33
mvaPete O'Hanlon17-Sep-12 10:33 
GeneralRe: Internal connection fatal error!! why?!! Pin
Jassim Rahma17-Sep-12 10:59
MemberJassim Rahma17-Sep-12 10:59 

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.