Results 1 to 4 of 4

Thread: An easy one

  1. #1

    Thread Starter
    Addicted Member AmmerBow's Avatar
    Join Date
    Sep 2000
    Posts
    195
    Im haveing a problem getting this to work. VB doesn't except the inet variable as the name of an object


    Dim inet As Object
    Dim y As Variant
    Dim x As Integer
    x = 1
    inet = "inet" & x

    'this is just sample code to show what in trying to do.
    inet.Protocol = icFTP
    inet.AccessType = icNamedProxy
    inet.URL = .Fields("sourceftp")
    inet.RemotePort = .Fields("sourceftpport")
    inet.UserName = .Fields("sourceusername")
    inet.Password = .Fields("sourcepassword")

  2. #2
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    Dim inet As Object
    Dim y As Variant
    Dim x As Integer
    x = 1
    inet = "inet" & x

    'this is just sample code to show what in trying to do.
    inet.Protocol = icFTP
    inet.AccessType = icNamedProxy
    inet.URL = .Fields("sourceftp")
    inet.RemotePort = .Fields("sourceftpport")
    inet.UserName = .Fields("sourceusername")
    inet.Password = .Fields("sourcepassword")
    You can't assign values to an Object variable like that. If you want the inet to be a winsock control (looks like it) then you use the SET keyword.

    Set inet = New Winsock

    Though I'm unsure where you're getting the other variables, the '.' variables have no foundation that I'm aware of in VB (I could be wrong) as the '.' usually denotes a method or property of an object.

    If you could clarify more what you're trying to do, then it would be easier to help you out
    -Excalibur

  3. #3

    Thread Starter
    Addicted Member AmmerBow's Avatar
    Join Date
    Sep 2000
    Posts
    195
    I am working on a program that will xfer files from an ftp site at certain times.

    Now, If i schedule 4 jobs to run at 1 am I don't want to say. inet1 (component) go and download this file from this site. then logoff and go the the next site and get its file, and so on until all 4 jobs are done.
    lets just say site 2 starts to download a 100meg file. I don't want my jobs waiting until the inet1 gets done before the others can go.

    So i was thinking that I would create a buffer of inet components (about 10).
    I would then just say. inet1 are you connected to a url right now? if so, goto inet2 and ask, and so on, until it finds an inet component thats not busy.

    Then once it finds a free inet component it uses that.

    What i was hoping is that I could find a work around without having all this same code posted over and over as below.:
    Code:
    If Inet1.URL = (Empty) Then
     Inet1.Protocol = icFTP
     Inet1.AccessType = icNamedProxy
     Inet1.Proxy = "sci-proxy-01:80"
     Inet1.URL = .Fields("sourceftp")
     Inet1.RemotePort = .Fields("sourceftpport")
     Inet1.UserName = .Fields("sourceusername")
     Inet1.Password = .Fields("sourcepassword")
    
     Dim command As String
     Dim fso As Variant
     Set fso = CreateObject("Scripting.FileSystemObject")
    
     fso.CreateFolder ("c:\gcs\ftptmp1")
     Dim dirpath As String
     dirpath = "d:\gcs\ftptmp1\"
     command = "get " & .Fields("sourceURL") & " " & dirpath
     Inet1.Execute , command
    End If
    
    
    If Inet2.URL = (Empty) Then
     Inet2.Protocol = icFTP
     Inet2.AccessType = icNamedProxy
     Inet2.Proxy = "sci-proxy-01:80"
     Inet2.URL = .Fields("sourceftp")
     Inet2.RemotePort = .Fields("sourceftpport")
     Inet2.UserName = .Fields("sourceusername")
     Inet2.Password = .Fields("sourcepassword")
    
     Dim command As String
     Dim fso As Variant
     Set fso = CreateObject("Scripting.FileSystemObject")
    
     fso.CreateFolder ("c:\gcs\ftptmp2")
     Dim dirpath As String
     dirpath = "d:\gcs\ftptmp2\"
     command = "get " & .Fields("sourceURL") & " " & dirpath
     Inet2.Execute , command
    End If
    
    'keep repeating this for 8 more times
    I was hoping that the code i posted above would work to simplify the whole proccess.

    Any Ideas????

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    You can't access controls with variable names.
    inet(x) you have to use Inet1, Inet2, Inet3
    Your first sample of code didn't have a set in it.
    You declared the object but didn't set it.
    Set inet = whatever the control object is (I don't know)
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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