。如何将初始目录放在bin文件夹中 [英] .How can I give the Initial Directory is in the bin folder

查看:111
本文介绍了。如何将初始目录放在bin文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

推荐答案

请看我对这个问题的评论。



你可能需要可执行目录。无论如何,请看我过去的两个全面答案:

如何找到我的程序目录可执行目录),

如何查找我的程序目录当前目录,特殊文件夹)。



如果这是我理解的方式你的问题,你需要结合这两个答案:首先,读取可执行目录,并将当前目录设置为相同的值。



-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


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...


这篇关于。如何将初始目录放在bin文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆