Results 1 to 9 of 9

Thread: List Problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    65

    List Problem

    VB Code:
    1. Pivat Sub Test_Click()
    2. Dim FList As String
    3. FList = Files. ' Problem
    4. Sock.SendData FList
    5. End Sub

    The Problem On That Is That I Want To Send The Whole List To The Other
    Like If I Add Items It Sends All My Items To The Other Program And Adds It On That List

    Like
    VB Code:
    1. FList = Files.WholeList
    As Example

    Files Is The Name Of My List

    Is There Any Trick For That

    Thnx

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: List Problem

    What is Files? A collection? A UDT?

    In any event, you'll have to either make a string out of the list and send the string, or send each item in the list, one at a time. You can't 'send' an object.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    65

    Re: List Problem

    Heres The Code. Its Not Ready But I Need To Fix The List Thing:

    Code:
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
                    ByVal hwnd As Long, _
                    ByVal nIndex As Long) As Long
    
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
                    ByVal hwnd As Long, _
                    ByVal nIndex As Long, _
                    ByVal dwNewLong As Long) As Long
                    
    Private Declare Function SetLayeredWindowAttributes Lib "user32" ( _
                    ByVal hwnd As Long, _
                    ByVal crKey As Long, _
                    ByVal bAlpha As Byte, _
                    ByVal dwFlags As Long) As Long
    
    Private Const GWL_STYLE = (-16)
    Private Const GWL_EXSTYLE = (-20)
    Private Const WS_EX_LAYERED = &H80000
    Private Const LWA_COLORKEY = &H1
    Private Const LWA_ALPHA = &H2
    
    Private Sub Close_Click()
    End
    End Sub
    
    Private Sub Form_Load()
        Me.BackColor = vbCyan
        SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
        SetLayeredWindowAttributes Me.hwnd, vbCyan, 0&, LWA_COLORKEY
        USock.Close
        USock.LocalPort = "3000"
        USock.Listen
    End Sub
    
    Private Sub Upload_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Upload.Top = Upload.Top + 10
    Upload.Left = Upload.Left + 10
    End Sub
    
    Private Sub Upload_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Upload.Top = 4820
    Upload.Left = 5180
    CDialog.ShowOpen
    Files.AddItem CDialog.FileTitle
    End Sub
    
    Private Sub USock_ConnectionRequest(ByVal RequestID As Long)
    Dim FList As String
    FList = Files.List
    If USock.State <> sckClosed Then USock.Close
    USock.Accept RequestID
    USock.SendData FList
    End Sub
    Thnx

  4. #4
    Addicted Member kewakl's Avatar
    Join Date
    Oct 2006
    Location
    between keyboard and chair
    Posts
    220

    Re: List Problem

    this line should error

    FList = Files.List

    Compile error:
    Argument not optional

    because you haven't specified an item in the list (0-based).
    Last edited by kewakl; Feb 28th, 2007 at 06:14 PM. Reason: [vbcode] is screwed up
    Do not use if shrinkwrap is broken or missing!
    I'm learning how to fish, too!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    65

    Re: List Problem

    Yeh But Wts The Thing That Uhm...
    It Sends All Items Thats On The List ?

    Thnx

  6. #6
    Addicted Member kewakl's Avatar
    Join Date
    Oct 2006
    Location
    between keyboard and chair
    Posts
    220

    Re: List Problem

    all i get is

    Compile error:
    Argument not optional

    ---------------------
    I pasted your code and made a CONNECTing prog.
    when i connect, the prog errors with the above error
    message and highlights the 'FList = Files.List' line
    Do not use if shrinkwrap is broken or missing!
    I'm learning how to fish, too!

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    65

    Re: List Problem

    Ohh

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: List Problem

    You have to loop through all the items in the list, load each file into a variable (a byte array would be best), sent the array, byte by byte, go on to the next file in the list, etc.

    BTW, NEVER use End to end the program - it's like escorting your guests out the 5th floor window at the end of the party. Use Unload Me instead - that closes things that are open. (You still have to destroy your own objects.)
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    65

    Re: List Problem

    Oooowh I Know What You Mean Thnx And Another Thnx For The End Thing

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