Click here to Skip to main content
15,894,646 members
Home / Discussions / C#
   

C#

 
GeneralRe: Calculate Plus Minus values from TextBox Pin
M Riaz Bashir23-Feb-11 20:29
M Riaz Bashir23-Feb-11 20:29 
GeneralRe: Calculate Plus Minus values from TextBox Pin
OriginalGriff23-Feb-11 20:56
mveOriginalGriff23-Feb-11 20:56 
GeneralRe: Calculate Plus Minus values from TextBox Pin
Anurag Gandhi23-Feb-11 21:27
professionalAnurag Gandhi23-Feb-11 21:27 
GeneralRe: Calculate Plus Minus values from TextBox Pin
OriginalGriff23-Feb-11 23:07
mveOriginalGriff23-Feb-11 23:07 
GeneralRe: Calculate Plus Minus values from TextBox Pin
Pravin Patil, Mumbai23-Feb-11 22:31
Pravin Patil, Mumbai23-Feb-11 22:31 
QuestionLINQ to xml query Pin
faheemnadeem23-Feb-11 18:34
faheemnadeem23-Feb-11 18:34 
AnswerRe: LINQ to xml query Pin
#realJSOP24-Feb-11 4:55
mve#realJSOP24-Feb-11 4:55 
QuestionHow to display a warning message in file uploading when the uploading file is open in user machine... Pin
Rocky2323-Feb-11 18:05
Rocky2323-Feb-11 18:05 
Hi,

will u tell me, how can i display an warning message to the user if the file he/she is uploading is open in his machine..

In my Application, i can upload only a file of type *.txt or *.csv,

so could u tell me how can i display a message to the user, when he is uploading a file of (.txt or .csv)type only when that particular file is open in his machine..

As of now in my application, it makes the application crash if that uploading file is open in user machine..

please check my code here..

private void BtnBrowseClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog file1 = new OpenFileDialog { Multiselect = false, Filter = "All Supported Files |*.txt;*.csv|Text|*.txt|CSV |*.csv"};
            if (file1.ShowDialog() == true)
            {
                new FileInfo(file1.FileName);
                try
                {
                    using (Stream str = file1.OpenFile())
                    {
                        TextReader reader = new StreamReader(str);
                        reader.ReadToEnd();
                        txtFileName.Text = file1.FileName;
                        txtFileName.IsEnabled = false;

                    }
                }
                catch
                {
                    txtFileName.Text = file1.FileName;
                    txtFileName.IsEnabled = false;
                    MessageBox.Show("Please check the file has been Closed before you upload", "Manual File Upload");
                }
            }
        }


It is showing warning message if i change the permission of that file(.txt or .csv) or if i dint changed the permission, it is not showing any warning message, could u tell me how can i do it in a right way..

If possible tell me with a sample code, so i change my code or alter it...


Thanks
GeneralRe: How to display a warning message in file uploading when the uploading file is open in user machine... Pin
Wayne Gaylard23-Feb-11 22:20
professionalWayne Gaylard23-Feb-11 22:20 
GeneralRe: How to display a warning message in file uploading when the uploading file is open in user machine... Pin
Rocky2323-Feb-11 22:42
Rocky2323-Feb-11 22:42 
GeneralRe: How to display a warning message in file uploading when the uploading file is open in user machine... Pin
Wayne Gaylard23-Feb-11 22:52
professionalWayne Gaylard23-Feb-11 22:52 
Questionc# Need help getting WPF window to draw behind desktop icons Pin
lanpartyes23-Feb-11 15:13
lanpartyes23-Feb-11 15:13 
AnswerRe: c# Need help getting WPF window to draw behind desktop icons Pin
SledgeHammer0123-Feb-11 18:13
SledgeHammer0123-Feb-11 18:13 
GeneralRe: c# Need help getting WPF window to draw behind desktop icons Pin
lanpartyes23-Feb-11 23:49
lanpartyes23-Feb-11 23:49 
Questionvb.net to c#.net Pin
David C# Hobbyist.23-Feb-11 14:49
professionalDavid C# Hobbyist.23-Feb-11 14:49 
AnswerRe: vb.net to c#.net Pin
RobCroll23-Feb-11 16:18
RobCroll23-Feb-11 16:18 
AnswerRe: vb.net to c#.net Pin
thatraja23-Feb-11 16:29
professionalthatraja23-Feb-11 16:29 
AnswerRe: vb.net to c#.net Pin
Pravin Patil, Mumbai23-Feb-11 23:49
Pravin Patil, Mumbai23-Feb-11 23:49 
QuestionQuestion about adding/removing account Pin
turbosupramk323-Feb-11 9:05
turbosupramk323-Feb-11 9:05 
AnswerRe: Question about adding/removing account Pin
GenJerDan23-Feb-11 9:42
GenJerDan23-Feb-11 9:42 
GeneralRe: Question about adding/removing account Pin
turbosupramk323-Feb-11 10:14
turbosupramk323-Feb-11 10:14 
GeneralRe: Question about adding/removing account Pin
GenJerDan23-Feb-11 10:38
GenJerDan23-Feb-11 10:38 
GeneralRe: Question about adding/removing account Pin
turbosupramk323-Feb-11 11:05
turbosupramk323-Feb-11 11:05 
GeneralRe: Question about adding/removing account Pin
GenJerDan23-Feb-11 11:08
GenJerDan23-Feb-11 11:08 
GeneralRe: Question about adding/removing account Pin
turbosupramk323-Feb-11 11:33
turbosupramk323-Feb-11 11:33 

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.