Click here to Skip to main content
16,004,974 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Save a Blank Picture box to database Pin
Dave Kreskowiak24-Oct-07 4:22
mveDave Kreskowiak24-Oct-07 4:22 
QuestionWindow Form Location vb.net2005 Pin
aransiola23-Oct-07 8:31
aransiola23-Oct-07 8:31 
AnswerRe: Window Form Location vb.net2005 Pin
Dave Kreskowiak23-Oct-07 9:10
mveDave Kreskowiak23-Oct-07 9:10 
GeneralRe: Window Form Location vb.net2005 Pin
aransiola23-Oct-07 22:27
aransiola23-Oct-07 22:27 
GeneralRe: Window Form Location vb.net2005 Pin
Dave Kreskowiak24-Oct-07 4:29
mveDave Kreskowiak24-Oct-07 4:29 
AnswerRe: Window Form Location vb.net2005 Pin
Tom Deketelaere23-Oct-07 20:41
professionalTom Deketelaere23-Oct-07 20:41 
GeneralRe: Window Form Location vb.net2005 Pin
aransiola24-Oct-07 9:34
aransiola24-Oct-07 9:34 
QuestionCode Is Not Working . Pin
Dan Suthar23-Oct-07 6:15
professionalDan Suthar23-Oct-07 6:15 
Hi,
I got a downloader program form internet but it was made in C# . I converted it to VB.NET . There is no errors in the code , but it isn't working !D'Oh! | :doh: Here is the few code form the whole project which is not working:
Imports System.IO<br />
Imports System.Net<br />
Imports System.Text<br />
Imports System<br />
Imports System.Collections.Generic<br />
Imports System.ComponentModel<br />
Imports System.Data<br />
Imports System.Drawing<br />
<br />
Imports System.Windows.Forms<br />
<br />
Imports System.Threading<br />
Public Class Download<br />
    Private thrDownload As Thread<br />
    ' The stream of data retrieved from the web server<br />
    Private strResponse As Stream<br />
    ' The stream of data that we write to the harddrive<br />
    Private strLocal As Stream<br />
    ' The request to the web server for file information<br />
    Private webRequest As HttpWebRequest<br />
    ' The response from the web server containing information about the file<br />
    Private webResponse As HttpWebResponse<br />
    ' The progress of the download in percentage<br />
    Private Shared PercentProgress As Integer<br />
    ' The delegate which we will call from the thread to update the form<br />
    Private Delegate Sub UpdateProgessCallback(ByVal BytesRead As Int64, ByVal TotalBytes As Int64)<br />
    ' When to pause<br />
    Private goPause As Boolean = False<br />
    Private Sub Download(ByVal startPoint As Object)<br />
        Try<br />
            <br />
            Dim startPointInt As Integer = Convert.ToInt32(startPoint)<br />
            ' Create a request to the file we are downloading<br />
            webRequest = DirectCast(Net.WebRequest.Create("http://dl.google.com/picasa/picasaweb-current-setup.exe"), HttpWebRequest)<br />
            ' Set the starting point of the request<br />
            webRequest.AddRange(startPointInt)<br />
<br />
            ' Set default authentication for retrieving the file<br />
            webRequest.Credentials = CredentialCache.DefaultCredentials<br />
            ' Retrieve the response from the server<br />
            webResponse = DirectCast(webRequest.GetResponse(), HttpWebResponse)<br />
            ' Ask the server for the file size and store it<br />
            Dim fileSize As Int64 = webResponse.ContentLength<br />
<br />
            ' Open the URL for download <br />
            strResponse = webResponse.GetResponseStream()<br />
<br />
            ' Create a new file stream where we will be saving the data (local drive)<br />
            If startPointInt = 0 Then<br />
                strLocal = New FileStream("C:\", FileMode.Create, FileAccess.Write, FileShare.None)<br />
            Else<br />
                strLocal = New FileStream("C:\", FileMode.Append, FileAccess.Write, FileShare.None)<br />
            End If<br />
<br />
            ' It will store the current number of bytes we retrieved from the server<br />
            Dim bytesSize As Integer = 0<br />
            ' A buffer for storing and writing the data retrieved from the server<br />
            Dim downBuffer As Byte() = New Byte(2047) {}<br />
<br />
            ' Loop through the buffer until the buffer is empty<br />
            While (bytesSize = strResponse.Read(downBuffer, 0, downBuffer.Length)) > 0<br />
                ' Write the data from the buffer to the local hard drive<br />
                strLocal.Write(downBuffer, 0, bytesSize)<br />
                ' Invoke the method that updates the form's label and progress bar<br />
                '					Me.Invoke(New UpdateProgessCallback(Me.UpdateProgress), New Object() {strLocal.Length, fileSize + startPointInt})<br />
<br />
                If goPause = True Then<br />
                    Exit While<br />
                End If<br />
            End While<br />
        Finally<br />
            ' When the above code has ended, close the streams<br />
            strResponse.Close()<br />
            strLocal.Close()<br />
        End Try<br />
    End Sub<br />
<br />
   <br />
<br />
End Class<br />



Any suggestions will be thankful. Smile | :)

Dan.
AnswerRe: Code Is Not Working . Pin
pmarfleet23-Oct-07 6:56
pmarfleet23-Oct-07 6:56 
AnswerRe: Code Is Not Working . Pin
Scott Dorman23-Oct-07 7:12
professionalScott Dorman23-Oct-07 7:12 
GeneralRe: Code Is Not Working . Pin
Dan Suthar24-Oct-07 6:22
professionalDan Suthar24-Oct-07 6:22 
GeneralRe: Code Is Not Working . Pin
Scott Dorman24-Oct-07 12:34
professionalScott Dorman24-Oct-07 12:34 
QuestionText Problem Pin
saldarius23-Oct-07 5:56
saldarius23-Oct-07 5:56 
AnswerRe: Text Problem Pin
pmarfleet23-Oct-07 6:15
pmarfleet23-Oct-07 6:15 
AnswerRe: Text Problem Pin
Scott Dorman23-Oct-07 7:21
professionalScott Dorman23-Oct-07 7:21 
Questionsending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:10
jkonduru23-Oct-07 5:10 
AnswerRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 5:19
mveDave Kreskowiak23-Oct-07 5:19 
GeneralRe: sending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:24
jkonduru23-Oct-07 5:24 
GeneralRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 5:32
mveDave Kreskowiak23-Oct-07 5:32 
GeneralRe: sending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:38
jkonduru23-Oct-07 5:38 
GeneralRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 5:43
mveDave Kreskowiak23-Oct-07 5:43 
GeneralRe: sending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:52
jkonduru23-Oct-07 5:52 
GeneralRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 6:05
mveDave Kreskowiak23-Oct-07 6:05 
QuestionChange to design view ms access's form from code Pin
haggenx23-Oct-07 4:49
haggenx23-Oct-07 4:49 
AnswerRe: Change to design view ms access's form from code Pin
Dave Kreskowiak23-Oct-07 5:03
mveDave Kreskowiak23-Oct-07 5:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.