How to add "..." button to a property to open up "File Open"?

S

slow learner

I am creating a control and thinking about adding a property to the control.
I will like a "..." button shown next to the value of this property when user
clicks on this property. I want to open up standard "File Open" dialog box
when the user then clicks on "..." button. Any suggestion or sample code?
 
N

Nathan Sokalski

That is something I tried to figure out for a while also, but once you see
an example it is actually quite simple. Here is an example I used I created,
along with the website that taught me how to do it:

Private Sub btnDownload_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDownload.Click
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition",
"attachment;filename=download.txt")
'Response.WriteFile(Server.MapPath("download.txt"))
Response.Write("This is a test download text file" &
ControlChars.NewLine)
Response.Write(Date.Now.ToLongDateString() & " " &
Date.Now.ToLongTimeString())
Response.End()
End Sub

My example asks the user to download a text file that contains the string
"This is a test download text file" followed by the date & time (note the
two Response.Write lines). If you want to give the user a file instead, set
the Response.ContentType to the appropriate string and use
Response.WriteFile instead (I have this line commented out, you will have to
uncomment it). You can also, if you want, use a combination of WriteFile and
Write when sending a text file. For more details, see the following site
which is where I learned how to do this:

http://www.dotnetspider.com/technology/kbpages/553.aspx

Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top