PDA

Click to See Complete Forum and Search --> : File open dialog box


LucGuldentops
Oct 24th, 2001, 07:14 AM
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?

schuurke28
Dec 3rd, 2001, 04:55 PM
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?

LucGuldentops
Dec 4th, 2001, 03:18 AM
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

schuurke28
Dec 4th, 2001, 08:57 AM
ooops, had to read your thread better....
will look at it tonight
see you thursday?