Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / August 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
slow learner - 25 Aug 2005 17:47 GMT
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?
Nathan Sokalski - 25 Aug 2005 19:24 GMT
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!
Signature

Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

>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?
Steve C. Orr [MVP, MCSD] - 26 Aug 2005 07:29 GMT
You'll probably want to use the Editor Attribute, as demonstrated in this
code sample:
http://SteveOrr.net/articles/InheritAndExtend.aspx

Signature

I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.