Treeview control works fine on XP but not Win 2K. Why???


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 15 of 15

Thread: Treeview control works fine on XP but not Win 2K. Why???

  1. #1
    Join Date
    Feb 2008
    Posts
    52

    Treeview control works fine on XP but not Win 2K. Why???



    Hi all,

    I'm testing new versions of our suite of software products on different Windows platforms and found this strange problem the other day.

    When running the test release on a clean Windows XP platform, the program adds nodes to a treeview control which represent records stored in an Access database. When a new document is created using the program (and subsequently this creates a record in the database), it adds the node to the treeview control to represent the record in the database. Now this works fine on XP. But when the test release was run on a Windows 2K platform, the program seems to get into a strange infinite loop within an if-else statement which adds the nodes to the treeview. I tried removing the code from the if-else block to see what would happen, but it just seems to jump back and forth within the if block (unfortunately, I'm not in the office so I can't post the code up at the moment which would probably help explain the problem better but I've written some pseudo code to try and illustrate the problem):

    if condition met then

    'on Windows 2000, the program seems to get into an infinite loop
    'here - if this line is removed, it doesn't matter; it still gets into an infinite
    'loop which is whats so strange
    Treeview1.Nodes.Add(-----)

    else if another condition met then

    Treeview1.Nodes.Add(-----)

    end if

    This is probably going to be very difficult to solve from what i've written here so I'll post the actual code up when I'm back in the office but if anyone has any ideas or knows of any bugs with the treeview control when running a release on Windows 2000 as opposed to XP then I would be very grateful as this stupid problem is driving me nuts!!!!

    Thank you

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    This really doesn't make a whole lot of sense. Although I've not used the TreeView in all that many projects, I have in a few and have not experienced performance differences between XP and Win2000.

    When you were stepping through the code with F8 did you notice any odd behavior with any variables that could be causing a problem?

    You said you were testing "new versions"? Does this mean that prior versions of your software had no issues with Win2000?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Feb 2008
    Posts
    52
    Quote Originally Posted by Hack
    This really doesn't make a whole lot of sense. Although I've not used the TreeView in all that many projects, I have in a few and have not experienced performance differences between XP and Win2000.

    When you were stepping through the code with F8 did you notice any odd behavior with any variables that could be causing a problem?

    You said you were testing "new versions"? Does this mean that prior versions of your software had no issues with Win2000?
    Thanks for the quick response!

    Yeh, I don't think I did a terrific job of explaining the problem!!! I'll try posting some code up when I get back in the office and hopefully that might make it a bit clearer

    When I stepped through, I didn't actually put a watch on any variables so I'll have a look at that.

    The older versions of the software worked fine on Win 2000 (in the new version, we upgraded from using DAO to ADO and the databases were upgraded from Access 97 to Access 2000 if thats any help)

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Did you upgrade MDAC?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Feb 2008
    Posts
    52
    Thanks for the advice!

    I'll check tomorrow when I'm back in the office (I'm going to see if the version number on the MDAC changes in the registry between the older version and the newer version of our software)

    I'm thinking I might have a look back through SVN as well to see what was changed between versions in the module that contains the code that is causing the problem

    I'll let you know what I find

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Well, I know there are issues between XP and Vista, but I don't recall seeing posts indicating trouble between XP and Win2000. I'm thinking that it has to be something relatively simple to fix.

    However, the problem often is determining what the relatively simple fix should be.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  7. #7
    Join Date
    Feb 2008
    Posts
    52
    Hi Hack,

    I've got the extract of code that seems to be where the program is jumping back and forth if you could take a look:

    Code:
    'clear traps
    On Error Resume Next
                
    'Iterate through the records - and then add in for each node
    'check each type of group
    For intTempLoop = 1 To intGroupCount
    'proceed
    While rsSet.EOF = False
                    
            'create parent
            Select Case intTempLoop
                   Case 1
                       'THE CODE JUMPS BACK AND FORTH WITHIN THIS CASE AND 
                       'THE STRANGE THING IS IF THIS LINE IS REMOVED, IT STILL  DOES IT!!!!
                       weldspec.TreeView1(listSelection).Nodes.Add strCurrentRoot, tvwChild, strCurrentRoot & rsSet.fields(4), rsSet.fields(1 + (intTempLoop * 2)), strBranchImg, strBranchImg
                   Case 2
                       weldspec.TreeView1(listSelection).Nodes.Add strCurrentRoot & rsSet.fields(4), tvwChild, strCurrentRoot & rsSet.fields(4) & rsSet.fields(6), rsSet.fields(1 + (intTempLoop * 2)), strBranchImg, strBranchImg                         
                   Case 3
                       weldspec.TreeView1(listSelection).Nodes.Add strCurrentRoot & rsSet.fields(4) & rsSet.fields(6), tvwChild, strCurrentRoot & rsSet.fields(4) & rsSet.fields(6) & rsSet.fields(8), rsSet.fields(1 + (intTempLoop * 2)), strBranchImg, strBranchImg
    End Select
                        
    'move to bnext
    rsSet.MoveNext
                        
    Wend
                    
    'move to bnext
    If rsSet.RecordCount > 0 Then
          rsSet.MoveFirst
    End If
                    
    
    Next intTempLoop
    Doubt whether you'd be able to work anything out from this but thought it might be worth a go!

    Cheers

  8. #8
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Is this Win2000 workstation or Win2000 server?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  9. #9
    Join Date
    Feb 2008
    Posts
    52
    its Win2000 workstation (Windows 2000 Professional Version 5.00.2195)

  10. #10
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    And it is up to date with all patches and service packs?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  11. #11
    Join Date
    Feb 2008
    Posts
    52
    It was fresh installed from onto a VMWare machine the other day and no patches or updates have been applied. I'm going to trying updating the system now to the latest service packs to see what happens

    I'll let you know how I get on!

  12. #12
    Join Date
    Feb 2008
    Posts
    52
    Actually, one of my colleagues has stated that the problem most likely is caused by the fact that the MDAC components are not up to date (as you previously stated) as we upgraded to ADO so I'm going to try and update the MDAC components as well to the latest version to see what happens.
    Last edited by adstheman; 02-13-2008 at 04:29 AM.

  13. #13
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    MDAC is definately my first guess, but you should also install those patches and service packs or you could be setting yourself up for other Win2000 related issues.

    Lets us know.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  14. #14
    Join Date
    Aug 2005
    Location
    Hermosillo, Sonora, Mexico
    Posts
    103
    Also, try eliminating the line
    Code:
    'clear traps
    On Error Resume Next
    or substitute for
    Code:
    On Error GoTo 0

  15. #15
    Join Date
    Feb 2008
    Posts
    52
    Well, I just upgraded the MDAC components to the latest version and it turned out this IS what the problem was!!! The software works fine now so thanks for all your help guys. I'm glad this is sorted now cos I can now release it!!!! WOO HOO!!!!

Similar Threads

  1. Replies: 0
    Last Post: 10-04-2005, 08:13 AM
  2. Microsoft IE Web Controls - Treeview control
    By norman_fung in forum ASP.NET
    Replies: 3
    Last Post: 07-13-2005, 12:36 AM
  3. TreeView Common Control Multiselect?
    By Mark Alexander Bertenshaw in forum VB Classic
    Replies: 4
    Last Post: 10-10-2001, 10:15 AM
  4. RtlMoveMemory call works in W98 but not in Win NT4.0
    By Lijo Joseph in forum VB Classic
    Replies: 4
    Last Post: 01-08-2001, 02:38 PM
  5. RtlMoveMemory call works in W98 but not in Win NT4.0
    By Lijo Joseph in forum VB Classic
    Replies: 0
    Last Post: 01-06-2001, 06:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center