Results 1 to 6 of 6

Thread: Best method for populating listview via winsock

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    352

    Best method for populating listview via winsock

    I have a server/client application that allows user to login, add/update/delete data using a winsock control array. So far, all the commands processed by the server are based on a single record....

    I am wondering what would be a good efficent method to populate a listview with about 1000 records, each record having about 10 fields (10-50 chars each field).

    I'm not sure if a using a multi-diminsion array would be practical....

    Loading each record one by one seems overly in-efficent...


    Any ideas on a model, thanks

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Best method for populating listview via winsock

    What ever you use, you will have to populate it one by one at some point. You can use a listview (set style to Report) and add the number of columns you need. Its easy to work with it using For Next Loops.

    You can use a FlexGrid too.

    What actually do you want to do? What data to store and for what purpose?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    352

    Re: Best method for populating listview via winsock

    Thanks for your input

    A little more detail....

    My goal is to build a table of search results...for example, sorted by ALL or CUSTOMER NAME, etc.... A filtered list if you will. Listview is easy to mimic greenbar (alternating row colors), and the listview ColumnClick event allows a fast resort of any column in ASC or DESC order.

    Currenlty, the client request send commands to the server requesting needed info along with tokens such as dates range, account#, other parameters, then returning the info to the requesting client. All winsock transfers currently send/receive each transaction within the length limit of the STRING data type.

    Populating the listview is not a problem.

    My dysfunction is on how to transfer the results of each search from the Server to the client intact.

    A) one long string?.... length could be a problem

    b) data strings containing chunks or x number of records.... seems logical ???

    c) a better method...
    Last edited by easymoney; Sep 28th, 2005 at 03:56 AM.

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Best method for populating listview via winsock

    Maybe each field as a new row. Lets say that a record has 3 fields (Name, AccNumber, Data). Transmision form the server to the client would look like this:

    John Doe
    4234
    Some Stuff
    Max Payne
    4366
    New stuff

    etc... So each field goes in a new row. And you can easily parse the data and the length wont be a problem. It will also be easy to populate the list as you know what every 3*X + 1 item is field one, 3*X + 2 is field two and so on (that is Stepping with For Next Loops)

  5. #5
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Best method for populating listview via winsock

    Of course, if a field is empty you will get an empty row so there wont be any errors regarding that.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    352

    Re: Best method for populating listview via winsock

    thanks, I follow you some, my brain just ain't functioning.

    I am using the split funtion to break the data transfered by winsock which delimited by chr(10) line feed


    'Server joins delimited fields with chr(10) into String, pass string to client via winsock
    Usersock.SendData "UBCustomerList" & Chr(10) & strUserName & Chr(10)

    'Client splits String data delimited by chr(10) char into fields using split funtion
    Split(Mid(GetRecv, 10, Len(GetRecv)), Chr(10))(1)

    record is now loaded into an array, easy to loop through array and populate one row with array....

    Then I can repeat for each record.

    I could delimit each record with one delimiter, inside which each record is delimted by a differnt delimter.... but keeping track of the chunks of records seems to be a chore.

    Maybe I am making harder than it should be... I am just trying to get a concept to build on.

    Probably not much help, maybe I will make some psuedo code clear thing up for everyone (including me, hehe)

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