在Visual Basic 2008中创建Filebrowser [英] creating Filebrowser in visual basic 2008

查看:91
本文介绍了在Visual Basic 2008中创建Filebrowser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我在Visual Basic 2008"vb.net"中有一个应用程序,该应用程序应允许用户在其界面中浏览以选择数据库文件.
有人可以帮助我创建此浏览器吗?

谢谢

HI everybody

I Have an application in visual basic 2008"vb.net" that should allow the user in its interface to browse to choose a database file.
can anybody help me to create this browser

thanks

推荐答案

据我从您的问题中了解到的是
您需要浏览以选择数据库文件
所以按照我的说法,为什么不使用openfiledialog控件
并在浏览"按钮上打开它,单击
过滤数据库文件的openfile对话框.然后可以选择
从那里下载必需的文件.也许可以为您提供一个开始.
As per what I understand from your question is that
You need to browse for selecting a Database file
So as per me why don''t you use a openfiledialog control
and open this on a Browse Button click
Filter the openfiledialog for database files.and then you can select the
required files from there.May this can give you a start.
Private Sub BtnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBrowse.Click
        Using OpenFileDialog As OpenFileDialog = Me.GetOpenFileDialog()

            If (OpenFileDialog.ShowDialog(Me) = DialogResult.OK) Then
                TxtFileName.Text = OpenFileDialog.FileName

            Else
                Exit Sub
            End If
        End Using
    End Sub


这里的TxtFileName是一个显示所选文件的文本框,下面是过滤openFileDialog的函数.


Here TxtFileName is a textBox which shows the selected file.Below is the function to filter the openFileDialog.

Private Function GetOpenFileDialog() As OpenFileDialog
        Dim openFileDialog As New OpenFileDialog

        openFileDialog.CheckPathExists = True
        openFileDialog.CheckFileExists = True

        openFileDialog.Filter = "SQL data files (*.mdf)|*.mdf"

        openFileDialog.Multiselect = False
        openFileDialog.AddExtension = True
        openFileDialog.ValidateNames = True
        openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

        Return openFileDialog
    End Function


就是这样全部尝试.我不是专家,但是可能可以为您提供帮助.您可以在Google中搜索Openfile对话框中的过滤数据库文件.我刚刚在这里为您提供了一个.


That''s all Try This.I am not an Expert But may this can help you out.You can Search Google for Filtering Database File inside Openfiledialog.I have just provided you here One.


您可以从开始. com/UploadFile/prvn_131971/OpenFileInVB11162005065226AM/OpenFileInVB.aspx"target =" _ blank"title =" New Window> ^ ]示例.

基本上,您首先需要使用此浏览器选择数据库路径和文件.加载数据库的方式取决于数据库,并且取决于数据库.
You can start with this[^] sample.

You will basically first need to choose the database path and file using this browser. How you load the database depends on the database and is upto you.


如果您使用Google,则可能会找到一些答案.
If you Google it, you might find some answers.


这篇关于在Visual Basic 2008中创建Filebrowser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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