Results 1 to 6 of 6

Thread: [RESOLVED] Manually FetchRowStyle

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Resolved [RESOLVED] Manually FetchRowStyle

    This part works:
    I have 2 lists
    Selecting a row in list1 causes list2 to be repopulated. If an item (sort of like an email) in list2 has not been viewed, its font is bold. So, if ANY item in list2 is bold, so is the entry in list1. So, you have say Sent Items, and Received Items in List1. Click on Sent Items, list2 contains all Sent Items. If ANY of the sent items in list2 are bold, I want the Sent Items entry in List1 to be bold.

    That works fine

    This part doesn't:
    When the FetchRowStyle events for list2 fires and Unbolds the last item in list2, the corresponding item in list1 will not unbold until the selection changes, or if you minimize and maximize. Basically, (duh) not until the FetchRowStyle event for list1 fires.



    The question:
    How do I force the FetchRowStyle event for list1 to fire for every row?

    I have tried a number of things (list1.refresh, creating my own FetchRowStyleEventArgs, etc.), and I cannot figure this out.
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Manually FetchRowStyle

    I have no idea what type of object these lists are. I just typed FetchRowStyle into MSDN and got no matches.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: Manually FetchRowStyle

    I was hoping you weren't going to zing me. I prefer to read those when it is about someone else.

    I typed FetchRowStyle in MSDN myself. I event attempted to dim my own FetchRowStyleEventArg, but the Row and Split properties are read only.

    These are ComponentOne lists, and if you weren't zinging me, FetchRowStyle is very similar to FetchCellStyle, it takes the same arguments. To make myself clear, the FetchRowStyle event is working properly for both lists, I just can't get a change in list2 to force list1 to fire its FetchRowStyle. The FetchRowStyleEventArgs are a private part of the lists, so I can't do a for each loop based of the FetchRowStyleEventArgs of list1.

    I can attempt to call list1_FetchRowStyle(), but I can't figure out how to create the e argument that it requires, or the sender for that matter (although I believe that would just be list1).
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Manually FetchRowStyle

    You should not be calling event handlers directly. If you want to execute the same code from different places then you put that code into a method and call it from those places. In that way you can call the same code from an event handler and other places too.

    You can't force an object to raise an event without creating the situation in which the event is raised. This control will not raise the FetchRowStyle event unless it needs to fetch a row style. Maybe it does that whenever it repaints. In that case you could call its Refresh method and force it to repaint.

    More than that I can't say because I don't use that component.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: Manually FetchRowStyle

    After beating my head against the wall for a while, I thought of using the refresh option, but that didn't work either. However, the list is the sole control (wow, that sounds cool) on a panel. Maybe I could try refreshing the panel itself, and not just the control. Unfortunately, I am no longer at work, so I can't try it right now. I will try refreshing the panel tomorrow and see if that works.
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Resolved Re: Manually FetchRowStyle

    Fixed it. I used list1.Refresh() in the Tick event of the timer (did I mention that) that unbolds an item in list2. I don't know why the same piece of code was not working when being called from the FetchRowStyle of list2, but it works now.
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

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