Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Hi I am using OpenFileDialog box  in windows form ..How can I give the Initial Directory is in the bin folder ,it never go for any ware in the mycomputer  Directory

Below is my code Can any one tel me ...Below is my code
VB
Private Sub linkTemplate_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles linkTemplate.LinkClicked
        Dim oImport As New OpenFileDialog()
        oImport.Title = "Save As"
        oImport.InitialDirectory = "BeTrans\bin\Debug\"''Hear only i need to Changer the Directory (bin floter)
        'oImport.FileName = txtDocEntry.Text
        oImport.Filter = "Excel Sheet(*.xls)|*.xls|Excel Sheet(*.xlsx)|*.xlsx"
        oImport.FilterIndex = 1
        oImport.RestoreDirectory = True
        If oImport.ShowDialog() = DialogResult.OK Then
            'txtDocEntry.Text = Import.FileName;
            'Import(oImport.FileName)
            Application.DoEvents()
        End If
    End Sub
Posted
Comments
Sergey Alexandrovich Kryukov 15-Nov-13 1:55am    
There is no such thing as "bin folder". There is just the "Output directory", which can be anything.
—SA

Please see my comment to the question.

It's likely that you need executable directory. Anyway, please see two of my past comprehensive answers:
How to find my programs directory (executable directory),
How to find my programs directory (current directory, "special folders").

If this is how I understood your problem, you will need to combine these two answers: first, read executable directory, and set current directory to the same value.

—SA
 
Share this answer
 
v2
VB
Dim dlg As New OpenFileDialog
            dlg.InitialDirectory = Application.StartupPath
           
Here Startupath is in Bin folder..
 dlg.InitialDirectory = "'Here you can enter you path


I hope this will helpful for you...
 
Share this answer
 
Comments
sp_suresh 15-Nov-13 6:08am    
basurajkumbhar is right you have to provide application startup path as initial directory
basurajkumbhar 15-Nov-13 6:11am    
ok

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900