Results 1 to 11 of 11

Thread: [RESOLVED] Need suggestion

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    151

    Resolved [RESOLVED] Need suggestion

    I am getting items from sent items in outlook in this format:

    To Subject Sent Date

    I am able to retrieve these bur how or where shouls i placed them?

    I have placed them in a list box but then they do not appear one below the other.. I hope ur getting me. What should i use? Also i want to select items from this list....

    Code:
    lstsentitems.AddItem Sentmail.To & "        " & Sentmail.Subject & "         " & Sentmail.SentOn
    I have written this code which just retrieving values an placing them in a list box..

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Need suggestion

    Drop them into an array. Make your list box return a list showing date/subject.
    On click of an item in the list box, use the listindex to find the relevant index in the array and display the other fields onto labels/text boxes under the list.

    just one option.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Need suggestion

    This will place them one below each other...

    VB Code:
    1. lstsentitems.AddItem Sentmail.To
    2. lstsentitems.AddItem Sentmail.Subject
    3. lstsentitems.AddItem Sentmail.SentOn

    this will place them into columns

    VB Code:
    1. lstsentitems.AddItem Sentmail.To & ";" & Sentmail.Subject & ";" & Sentmail.SentOn

    Your code will place them into one column and the scroll bar will be activated..

    I personally would allow the list box to have three columns, setting the bound column to be 2 this way multiple mails can be added using the subject as the main identifier. When the user clicks on an item in the listbox the relevant information can be retrieved from the column to which it is placed (-1 as 0 bound).. For Example

    VB Code:
    1. Private Sub lstsentitems_Click()
    2.   txtTo.Value = lstsentitems.Column(0,lstsentitems.listindex) 'First Column
    3.   txtSubject.Value = lstsentitems.Column(1,lstsentitems.listindex) 'Second Column
    4.   txtSentOn.Value = lstsentitems.Column(2,lstsentitems.listindex) 'Third Column
    5. End Sub
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    151

    Re: Need suggestion

    how will i devide listbox in 3 parts?
    i want somthing like this :


    [email protected] hi 21/2/1904
    fdaf@jjhkskfsfsdf bye 54/90/9867
    [email protected] hieeee 13/09/9876

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    151

    Re: Need suggestion

    sorry !
    It should not be like that

    all to one below other, all subject one below other........

  6. #6
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Need suggestion

    Ok do you want the list box to look like..

    Displayed - Columns
    Hi - [email protected]|Hi|21/2/1904
    Bye - fdaf@jjhkskfsfsdf,54/90/9867
    hieeee - [email protected]|hieeee|13/09/9876

    If so then set Column Count of Listbox to 3 and Bound Column to 2, then the column widths to "0cm;5cm; 0cm". And it will only show the subject message, but the remainder will be available like in the code in my previous post.
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    151

    Re: Need suggestion

    I have tried the code given by u....

    Code:
    For Each Sentmail In oSentFolder.Items
            Sentmail.To = lstsentitems.Columns(0, lstsentitems.ListIndex) 'First Column
            Sentmail.Subject = lstsentitems.Columns(1, lstsentitems.ListIndex) 'Second Column
            Sentmail.SentOn = lstsentitems.Columns(2, lstsentitems.ListIndex) 'Third Column
    its giving error wrong number of argument or invalid property assignment if i say---- columns


    and if i kept it like ---column then its saying method or data member not found.

  8. #8
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Need suggestion

    Are you sure this is a list box??

    Can't remember if the list box control in vb6 has a columns property, check on the properties of the list box for "Column Count".. If not there then we will have to use the array method.
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    151

    Re: Need suggestion

    yes its a list box.
    and it has a property called columns..
    at design timr i have used property columns with value 3 (i.e. 3 columns)

  10. #10
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Need suggestion

    Looking at it you have the syntax the wrong way round.. you are trying to assign the value of the column to the Sent Items..

    VB Code:
    1. For Each Sentmail In oSentFolder.Items
    2.         Sentmail.To = lstsentitems.Columns(0, lstsentitems.ListIndex) 'First Column
    3.         Sentmail.Subject = lstsentitems.Columns(1, lstsentitems.ListIndex) 'Second Column
    4.         Sentmail.SentOn = lstsentitems.Columns(2, lstsentitems.ListIndex) 'Third Column

    Should be

    VB Code:
    1. For Each Sentmail In oSentFolder.Items
    2.     lstsentitems.Columns(0, lstsentitems.ListIndex) = Sentmail.To
    3.     lstsentitems.Columns(1, lstsentitems.ListIndex) = Sentmail.Subject
    4.     lstsentitems.Columns(2, lstsentitems.ListIndex) = Sentmail.SentOn

    What I was showing you was how to empty the information into text boxes on a form from the relevant columns in the listbox, not how to populate the listbox's columns..
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    151

    Re: Need suggestion

    Thank You !
    I got it!

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