473,698 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating button text while downloading a file.

Markus
6,050 Recognized Expert Expert
I want the download button to update while a file download is in progress - "Connecting ", "Downloading.." , etc. But with the code below, it does not update the text. I've read about Application.DoE vents() but also heard that this isn't the best route to take? If it is OK to use Application.DoE vents(), where should I use it?

Expand|Select|Wrap|Line Numbers
  1. button1.Text = "Connecting...";
  2.             Uri URL = new Uri("http://mahcuz.com/projectdownload/ClipboardIP/updatediplist.xml");
  3.             try
  4.             {
  5.                 WebClient Client = new WebClient();
  6.                 button1.Text = "Downloading...";
  7.                 Client.DownloadFile(URL, Application.StartupPath + "/IP.xml");
  8.                 button1.Text = "Finished";
  9.             }
  10.             catch (Exception Ex)
  11.             {
  12.                 button1.Text = "Failed";
  13.             }
Nov 11 '08 #1
2 1099
Plater
7,872 Recognized Expert Expert
I see you took a different route using the IE object instead of HttpWebRequest.

Anyways, in that situation you described, calling button1.Update( ) (force redraw of buton1) would be more suitable then a full Application.DoE vents().
Nov 11 '08 #2
Markus
6,050 Recognized Expert Expert
I see you took a different route using the IE object instead of HttpWebRequest.

Anyways, in that situation you described, calling button1.Update( ) (force redraw of buton1) would be more suitable then a full Application.DoE vents().
Yeh, I couldn't find an example of using HttpWebRequest for a file download.

button1.Update( ) works wonders.

Thanks, Plater.
Nov 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3933
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company 1&1 with only limited server configuration via a web based control panel. My query relates to the ASP security model and how it relates to FrontPage options for setting file access on a database file. If you know of any online documentation...
1
1135
by: Dharmanet | last post by:
Hi, I have a Page1.aspx with a Datagrid which has a link button which spawns a download of a file. one of the columns shows how man times the files were downloaded. The Datagrid is bound to a datasource. Once the download is done the Datagrid is asked to Databind itself once more this part does not work. when this code is executed the download is not yet over and the downloading dialog is still on. please let me know how i can
4
1648
by: Edwin Knoppert | last post by:
I have a problem with downloading a PDF by using the response object. A part of it: ..Response.Clear() ..Response.ContentType = sFileType ..Response.AppendHeader("Content-Disposition", "attachment; filename=" & sFileNameOut) ..Response.AppendHeader("Content-Length", fs.Length.ToString) ..Response.AppendHeader("Content-Transfer-Encoding", "BINARY") ..Response.Flush()
22
6415
by: Mal Ball | last post by:
I hope I have the right forum for this question. I have an existing Windows application which uses a SQL Server database and stored procedures. I am now developing a web application to use the same database. The original Update and Delete SP's all use a timestamp for concurreny checking. I am trying to use the same Update SP from my sqlDataSource but I keep getting the following error:
0
1371
by: Michael Kellogg | last post by:
I have a problem wherein a query that updates a GridView doesn't seem to really stay in sync with a label I have above the GridView. I have a GridView object that I'm updating with information whenever my user enters a job number into a textbox and hits a button. There is a SQLDataSource object on the page that does the retrieval of the data, and the job number parameter for its query is bound to the textbox "Text" value. In the button...
4
1987
by: rdemyan via AccessMonster.com | last post by:
My application is calculation intensive and the servers are agonizingly slow. Administrators of my application only update the backends once a month (twice a month max). So, my launching program allows the back-end file to be downloaded to the user's PC. This will provide maximum speed for these calculations/manipulations of data. Without this, just logging into the main app connected to the server back-end file can take five minutes...
2
1635
by: UKuser | last post by:
Hi Folks, I havent used javascript in ages, and am not the worlds guru, but I'm playing with ajax linking to my database and an updating area. I have an area named display for example which lists each entry (from a PHP/MySQL db) with a remove button at the end of each record which feeds a unique ID to my ajaxfunction below: function ajaxFunction(rec){
15
2490
by: slinky | last post by:
Thanks in advance fo rany help... I have an XML data file (well- formed) that I need to place into my website's app_data folder. I would like to have an .aspx form on my site that simply has two textboxes (corresponding to two XML fields in my file), and a "submit" button that will update the file. Any clues as to the code to use? I'm most familiar with the DataAdapter/DataSet model and using SQLserver files and having an INSERT INTO...
3
1332
by: slinky | last post by:
I have an aspx for with a textbox and a button. The goal is to simply have the user type a message, hit the button and it should append to the XML file. I can open the aspx in the browser with no problem, but the XML file does not get updated. What's wrong with this code? Thanks! <script runat="server"> Private Sub Page_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.