Results 1 to 3 of 3

Thread: [2005] textbox issues

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    48

    [2005] textbox issues

    My program is basically downloading a file at a certain interval on a single thread and has a log window to show the status, it's suppose to put the timestamp into the textbox before it downloads the file but it doesn't do it until after it's finished downloading, i'm not sure why it would do that, anyone?

    ex.

    Code:
    txtLog.Text += "[" & Date.Now() & "]  " & "Downloading..." + vbCrLf
            My.Computer.Network.DownloadFile _
            ("http://www.google.com/index.html", _
            currentdir)
    txtLog.Text += "[" & Date.Now() & "]  " & "Done" + vbCrLf

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] textbox issues

    Call the TextBox's Refresh method to force it to repaint before calling DownloadFile. Also, don't do this:
    vb.net Code:
    1. txtLog.Text += "[" & Date.Now() & "]  " & "Downloading..." + vbCrLf
    but rather this:
    vb.net Code:
    1. txtLog.AppendText(String.Format("[{0:f}]  Downloading...{1}", _
    2.                                 Date.Now, _
    3.                                 Environment.NewLine))
    You can change the 'f' to a different format string if you don't want the full short format.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    48

    Re: [2005] textbox issues

    thanks

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