.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

C#NET2008 OpenFileDialog

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :Windows Application


Hullo my lovely friends,

I am back asking for help. Please help me.

I am trying to use OpenFileDialog control to prompt the users to select only file with extension .XML


Apparently I don't know how to only display files with .XML on the FileDialog display screen. Instead it all all the files kept in the Folder. It's causing confusion to the users as the folder contained more than 540 files.


Here are my coding that is not displaying on specific files with .XML


 String strFileNameNPath

View Complete Post

More Related Resource Links

Openfiledialog.initialdirectory is not working

Hi   I am opening a openfiledialog where i need the initial directory to be set to my computer: openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);   But everytime the dialogbox opens the directory shown is Mydocuments and when debugging it is the debug directory of the project.   am i doing anything wrong. Im using the openfiledialog from the Microsoft.Win32 namespace.   thanks

C#NET2008 FrmMain using DELEGATE CLASS Method



Hullo Good Guys,


I am back here seeking help. Please Help me.


Here us the description of what I was ihstructed to do by the System Analyst.


Create DELEGATE Class to perform Mortgage computation and return the result back to the calling FrmMortgage.cs. Apparently my coding are not working as I am not familiar with DELEGATE Class


Here are the Erro

OpenFileDialog OK/Cancel button closes form that opened it


After clicking OK or Cancel from the OpenFileDialog, the calling form gets closed not allowing user to push OK on calling form to save changes.  Strange thing is, if calling form is opened modeless from main form, this does not happen.  But I do not want this form to be left open modeless.

Here's the code:

Main Form opens form to change a file path

    Private Sub AdvancedDatabaseConfigurationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AdvancedDatabaseConfigurationToolStripMenuItem.Click

        Dim formDBPath As New frmDBPath


    End Sub
formDBPath has a button to browse to new file path which opens the OpenFileDialog
  Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click

    Dim openResult As DialogResult = Me.OpenFileDialog1.ShowDialog(Me)

    If openResult = Windows.Forms.DialogResult.Cancel Then Exit Sub
    Me.txtNewDBPath.Text = Me.OpenFileDialog1.FileName

  End Sub

 When I step through in the debugger, I click OK on the OpenFileDialog, it returns to btnBrowse_Click sub and sets the textbox text, then control passes back to main form sub AdvancedDatabaseConfigurationToolStripMenuI

C#Net2008 Window Application - F5 launch wrong FORM


Hullo Good Friend,

I encounter another interesting problem.

I need your help. Please help me.

I am writing a new C#Net2008 Window Application. The first FORM that was created is FrmSales.cs

Then I created another FORM FrmMainMenu.cs which is the Main Menu form with 6 command buttons to load other forms.

When I pressed F5 to launch the application, FrmSales.cs appears instead of FrmMainMenu .

What must I do to make FrmMainMenu the initial form to lauch. Which provide menu options for the user to select and load other specific FORM.

how to insert a path file into an array and listview using openfiledialog with multiselect property?



i have problem to insert path file into an array and listview(detail) using open file dialog wit multiselect property, please give me sample to make it?

C#Net2008 How to declare ARRAY


Hullo Good Guys,

I need your help. Please Help me.

I am using C#NET2008 for Window Application.

I encounter problem trying to declare ARRAY to store 5 String type Data.

And I encounter error message because I have not done it before.


Error message generated by this coding: private string strArray[5];

C#Net2008 Using UpperCase and LowerCase command


Hullo Awesome Helpers,

I need your help. Please help me.

I am trying to convert data from TextBox control to either Uppercase or Lowercase. As I have not used these command before with C# my coding is not working:

Here the the codings that are not working

Convert Client name from TextBox into Upper case

string strExt = Uppercase(txtClientname.Text);


Convert Country name from TextBox into Lower case

string strExt = Uppercase(txtClientname.Text);


Error messages generated by both lines of coding

Error 1 The name 'Uppercase' does not exist in the current context

Error 2 The name 'Lowercase' does not exist in the current contex

Error while using OpenFileDialog(). <>




I am having an aspx page from which, on a button click an open file dialog should open up from which i can select a file.

i wrote the following code on the button's click event.

OpenFileDialog _filedialog = new OpenFileDialog();

            _filedialog.InitialDirectory = @"C:\";
            _filedialog.Title = "Add Preview Image";
            _filedialog.Filter = "Image files|*.jpeg;*.jpg;*.bmp;*.png";
            _filedialog.RestoreDirectory = true;
            if (_filedialog.ShowDialog() == DialogResult.OK)
                txtPromoPreviewImagePath.Text = _filedialog.FileName;


Now, when i run the project and click the button, hoping to see the open dialog file browser window, i see this following error.

Current thread must be set to sin

C#NET2008 Using Microsoft WORD Template


Hullo Good Guys,

I encountered an interest error trying to transfer data from DR (DataReader) onto WORD 2003 Template created with Textbox and Table. The folder path and Template document name was retrieved by using OPENFILEDIALOG.



Error message:

Error 1     The best overloaded method match for 'Word.Documents.Add(ref object, ref object, ref object, ref object)' has some invalid arguments


This coding generate the error message above

Localizable OpenFileDialog


I am using Visual Studio 2010 and .NET 4.0.  I have Windows 7 Ultimate and multiple language packs installed, including German (de-DE).  The following code will display all of my C# strings from my German satellite assembly, but the OpenFileDialog will still be in my OS native language, en-US, unless I change the location for my entire computer in the control panel.  The following code will display the file dialog in the OS selected language, even if the UI culture is set before the call to Application.Run.

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE");
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = whatever;



I think this is a bug in the way .NET works.  At a minimum, all of the Microsoft documentation that describes CurrentUICulture o

savefiledialog and openfiledialog: Selecting existing file or creating a new one


In my application (C#) users need to select existing file or create new file where they want to save some data. Existing files are in read-only mode because they are under Perforce subversion source control. I'm going to handle file checkout in my application automatically after user has selected the file where he wants to save data (or if file is new file, application adds it to source control).

The problem is that I can't use savefiledialog, because it complains about selected file being read-only. I could use openfiledialog, but it has couple problems. First problem is that openfiledialog confirm button has text "Open", which is something i could live with even though it would be better if it read "Save" :)

Second and bigger problem is when you want to create new file in openfiledialog. I set CheckFileExists to false so when user writes file name and presses "Open"-button, openfiledialog doesn't complain about file because it doesn't exist and it returns path to "new" file just fine. But problem is that if user has clicked or selected to some folder in openfiledialog and then writes file name and presses "Open"-button, openfiledialog just opens selected folder.

So basically I just need some file browsing dialog which works like savefiledialog but doesn't complain about read-only, i just need to

Activity Designer with OpenFileDialog


I have a custom activity with an InArgument<string> FileName. I want to write a designer for it, where I can choose a file. I think what I need is a ExpressionTextBox and a button. What code is needed in the eventhandler of the button? How can I set the FileName of the activity with the result of the OpenFileDialog?


Problem Thumbnails in OpenFileDialog on Windows 7 64-bit



I have written a Thumbnail Provider with C# using IExtractImage.

It works great on Windows 7 32-bit and Windows XP 32-bit.

On Windows 7 64-bit, it works well in explorer; it does not work in Open File Dialogs from my Windows Form 32-bit application or from Firefox 32-bit (File/Open File);

all I see are big white file icons; thumbnails are not generated.

The DLL is targetting any CPU, .NET Framework 4.

The Exe Windows Form is targetting x86, .NET Framework 4.

To solve the problem, I think I would need to change the Exe target to any CPU, but I can not since the Exe is also using x86 assemblies.

How to solve the problem ?

Thank you


how to run vb.net2008 developed application on system XP-SP3 and framework4.0 installed


hello friends

Hello please help me regarding the following issue.
I have developed the vb.net application in vs2008  and made EXE.
I want to instal on other system with configuration XP-SP3 and DOTNETFRAMEWORK4.0,WindowsXP-KB942288-v3-x86 installed.

after my exe got installed on running the exe file it is throwing error "Application Encountered Problem and be closed"

Please please give any resolution its very urgent. any help appreciated.





ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend