Results 1 to 4 of 4

Thread: File open dialog box

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Belgium/Antwerp
    Posts
    275

    Question File open dialog box

    Anybody knows how to get the path of a file in a textfield using a file selector (common dialog control in VB6) in webforms, using vb.net?

  2. #2
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    the file selector is named openfiledialog (standard in toolbox)

    this is the way to get the path in a textbox:

    Public Class Form1
    Inherits System.Windows.Forms.Form

    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
    Me.TextBox1 = New System.Windows.Forms.TextBox()
    Me.SuspendLayout()
    '
    'TextBox1
    '
    Me.TextBox1.Name = "TextBox1"
    Me.TextBox1.TabIndex = 0
    Me.TextBox1.Text = "text1"
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 266)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1})
    Me.Name = "Form1"
    Me.Text = "Form1"
    Me.ResumeLayout(False)

    End Sub

    #End Region
    Dim tekst As String
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.OpenFileDialog1.ShowDialog()

    Me.TextBox1.Text = Me.OpenFileDialog1.FileName




    End Sub
    End Class


    Is this what u mean Luc?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Belgium/Antwerp
    Posts
    275
    Sorry Ed,

    You tried to do it in a WinForm (vb application .exe) but i need it in a WebForm (Web application .aspx)

    Thanks for looking at it.

    Greetz, Luc

  4. #4
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    ooops, had to read your thread better....
    will look at it tonight
    see you thursday?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width