CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2001
    Posts
    6

    Control Break processing

    I need to know how to enter a new headline every time the first field in a ListBox changes.

    My output looks like this:

    1 56743 $1200
    1 64564 $5400
    2 56456 $7853
    3 98798 $5645
    3 54564 $5456
    4 98798 $5645
    ETC..

    SO how do I enter a new headline any time the 1,2,3 or 4 change.
    This is being displayed in A LISTBOX.
    Thanks,
    Ben


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Control Break processing

    What do you mean with headline? Do you need to add a new line in your listbox and have it in first position?

    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Mar 2001
    Posts
    6

    Re: Control Break processing

    Sorry, I mean I want to Add a new Header like:
    JOB CODE EMP NUMBER SALARY etc..
    Any time the first field which is job code changes.


  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Control Break processing

    If matter is to put a line in first position of listbox, you can try this code:
    Dim i As Integer
    For i = 0 To 3
    List1.AddItem i 'just to put some data
    Next i
    'now insert a new first line:
    List1.AddItem "job,code,match", 0 'where 0 is the index position, which means: as first row.
    If you want this to work each time something change, you should put the
    list1.additem "job, etc",0
    instruction in the event where you make the list1 values to change.
    To look for modified first column values (remember you're testing a string) you should store values in an array (just first column value) and test if new values differs from old ones:

    for i= 1 to list1.listcount-1
    if left(list1.list(i),1)<> myoldvalue(i) then 'suppose your first column is only 1 char len
    'something changed
    'redraw line you need,
    'refresh your "myoldvalue" array
    end if
    next i

    This is only an example, you should work on this to make it suite you.

    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Mar 2001
    Posts
    6

    Re: Control Break processing

    Thank You I believe this will work!!!!!


  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Control Break processing

    Good. If it is not enough, post a new question, and name it:
    "listbox question"
    as "control break process" seems a little confusing...
    Best regards,
    Cesare Imperiali

    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

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

Featured