Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 2nd, 2009, 10:48 AM
Danbannan Danbannan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 4 Danbannan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 45 sec
Reputation Power: 0
Question Download a file and use SaveFileDialog.Filename

Hi there, im completely new to VB and im trying to learn myself how to download a file and use the SaveFileDialog with it. I cant see what im doing wrong

Please help me with this one dear community, btw, great forum :-)


Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strFileName As String
        

        strFileName = SaveFD.FileName
        SaveFD.InitialDirectory = "C:\"
        SaveFD.Title = textbox.Text
        SaveFD.Filter = "All Files|*.*"
        SaveFD.ShowDialog()
        If My.Computer.Network.IsAvailable Then
            If My.Computer.Network.Ping("74.125.67.100") Then
                MsgBox("Access Granted")
                My.Computer.Network.DownloadFile(textbox.Text, strFileName)
            Else
                MsgBox("ERROR")

            End If

        End If
    End Sub
End Class


What am i doing wrong here? i get the error:
Argument cannot be Nothing. Parameter name: destinationFileName

I guess its pretty simple but i cant figure it out

Last edited by Danbannan : October 2nd, 2009 at 10:51 AM. Reason: Forgot some details

Reply With Quote
  #2  
Old October 2nd, 2009, 05:09 PM
June7 June7 is offline
Contributing User
Click here for more information.
 
Join Date: Apr 2009
Location: The Great Land
Posts: 1,059 June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level)June7 User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 8 h 33 m 31 sec
Reputation Power: 224
Error might be generated because need to qualify reference to the textbox with form name or the Me alias. Try Me.textbox.Text. Recommend you give textbox a more descriptive name such as tbxDestFileName

Reply With Quote
  #3  
Old October 5th, 2009, 10:05 AM
Danbannan Danbannan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 4 Danbannan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 45 sec
Reputation Power: 0
Solved

Thanks for the input :-)

I have worked some more, and figured out that part. Now im doing the download from a listbox with added links.

Ok, so i have an almost working program here, i stumbled upon a error i cant seem to figure out, so dear community, i seek your help again.

Code:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Startnumber As Integer
        Dim Endnumber As Integer
        Dim i As Integer
        Startnumber = ListBox1.TopIndex
        Endnumber = ListBox1.Items.Count


        For i = Startnumber To Endnumber

            My.Computer.Network.DownloadFile(ListBox1.Items.It  em(1), "C:\test" & i & ".zip", "", "", True, 100, True)
            MsgBox("Download of " & i)
            ListBox1.Items.RemoveAt(1)
        Next i
    End Sub


I cant seem to figure this out, it starts to download the first file in the listbox, and nr2, nr3, nr4, nr5, nr6, When it comes to nr7 the program stops working an i get an error that says (InvalidArgument=Value of '1' is not valid for 'index'. Parameter name: index) it points to this line:

My.Computer.Network.DownloadFile(ListBox1.Items.It em(1), "C:\test" & i & ".zip", "", "", True, 100, True)

How come? I feel im getting closer to make my downloader tho, my first program :-)

Again, i would appreciate help greatly!!

Edit: SOLVED! Zero count based ofcourse :-)

Last edited by Danbannan : October 5th, 2009 at 11:37 AM. Reason: SOLVED

Reply With Quote
  #4  
Old October 7th, 2009, 06:22 PM
Danbannan Danbannan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 4 Danbannan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 45 sec
Reputation Power: 0
Ok, so i have yet stumpled upon a little case here, im trying to let the download try to download the file, wait for some time and try to download it again, and wait more if it cant and download it again, until it can (rapidshare, just for fun and nothing else, illegal?) The thing with free accounts is that you have to wait a certain time before and after downloads. So i will make a program do this for me. I can add many downloads from rapidshare and the program downloads it for me when it have access. So how can a make this try loop. Im pretty new to this so i havent gotten a working example yet, i have managed to download series of files after each other reading links from a listbox, pretty cool tho :-) If you guys want i can share the entire code for the download button :-)

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Download a file and use SaveFileDialog.Filename


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 10 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek