Click here to Skip to main content
15,885,771 members
Home / Discussions / C#
   

C#

 
GeneralRe: operate the pc through voice command in c# Pin
aeman23-Feb-11 6:49
aeman23-Feb-11 6:49 
AnswerRe: operate the pc through voice command in c# Pin
Member 873075321-Apr-12 11:26
Member 873075321-Apr-12 11:26 
QuestionIframe page login not working fine in IE...,But working fine in Mozila browser..., Pin
Member 387988122-Feb-11 1:22
Member 387988122-Feb-11 1:22 
AnswerRe: Iframe page login not working fine in IE...,But working fine in Mozila browser..., Pin
Peter_in_278022-Feb-11 15:54
professionalPeter_in_278022-Feb-11 15:54 
QuestionHow to display Warning Message When Uploading a File.. Pin
Rocky2322-Feb-11 0:18
Rocky2322-Feb-11 0:18 
AnswerRe: How to display Warning Message When Uploading a File.. Pin
Luc Pattyn22-Feb-11 0:32
sitebuilderLuc Pattyn22-Feb-11 0:32 
GeneralRe: How to display Warning Message When Uploading a File.. [modified] Pin
Bernhard Hiller22-Feb-11 20:31
Bernhard Hiller22-Feb-11 20:31 
GeneralRe: How to display Warning Message When Uploading a File.. [Code Updated] Pin
Rocky2322-Feb-11 23:18
Rocky2322-Feb-11 23:18 
No 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", "LRM..! Manual Feed File Upload");
                }
            }
        }


It is showing warning message if i change the security of that file,but it i think that is not a right way..
So could u tell me the solution, if it needed ignore my code and tell me with a new sample of code..

modified on Wednesday, February 23, 2011 6:03 AM

QuestionPreventing MDI child form from losing focus Pin
Dewald21-Feb-11 23:24
Dewald21-Feb-11 23:24 
AnswerRe: Preventing MDI child form from losing focus Pin
Mycroft Holmes22-Feb-11 0:07
professionalMycroft Holmes22-Feb-11 0:07 
GeneralRe: Preventing MDI child form from losing focus Pin
Wayne Gaylard22-Feb-11 0:44
professionalWayne Gaylard22-Feb-11 0:44 
GeneralRe: Preventing MDI child form from losing focus Pin
Dewald22-Feb-11 0:51
Dewald22-Feb-11 0:51 
GeneralRe: Preventing MDI child form from losing focus Pin
Mycroft Holmes22-Feb-11 11:00
professionalMycroft Holmes22-Feb-11 11:00 
GeneralRe: Preventing MDI child form from losing focus Pin
Dewald22-Feb-11 19:03
Dewald22-Feb-11 19:03 
GeneralRe: Preventing MDI child form from losing focus Pin
Mycroft Holmes22-Feb-11 19:34
professionalMycroft Holmes22-Feb-11 19:34 
GeneralRe: Preventing MDI child form from losing focus Pin
Dewald22-Feb-11 19:45
Dewald22-Feb-11 19:45 
QuestionGet IP address on a LAN [modified] Pin
Mc_Topaz21-Feb-11 23:14
Mc_Topaz21-Feb-11 23:14 
AnswerRe: Get all IP address on a LAN Pin
Rob Philpott21-Feb-11 23:32
Rob Philpott21-Feb-11 23:32 
GeneralRe: Get all IP address on a LAN Pin
Mc_Topaz21-Feb-11 23:43
Mc_Topaz21-Feb-11 23:43 
GeneralRe: Get all IP address on a LAN Pin
Rob Philpott22-Feb-11 1:39
Rob Philpott22-Feb-11 1:39 
AnswerRe: Get IP address on a LAN Pin
OriginalGriff21-Feb-11 23:36
mveOriginalGriff21-Feb-11 23:36 
Questionhandle data in GUI (datagridview) and database Pin
Ronenb21-Feb-11 21:29
Ronenb21-Feb-11 21:29 
AnswerRe: handle data in GUI (datagridview) and database Pin
OriginalGriff21-Feb-11 21:48
mveOriginalGriff21-Feb-11 21:48 
GeneralRe: handle data in GUI (datagridview) and database Pin
Mycroft Holmes22-Feb-11 0:10
professionalMycroft Holmes22-Feb-11 0:10 
GeneralRe: handle data in GUI (datagridview) and database Pin
OriginalGriff22-Feb-11 0:14
mveOriginalGriff22-Feb-11 0:14 

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.