| How to get the block's length in TrackControl?
 
 Printed From: Codejock Forums
 Category:  Codejock Products
 Forum Name:  Report Control
 Forum Description:  Topics Related to Codejock Report Control
 URL: http://forum.codejock.com/forum_posts.asp?TID=19003
 Printed Date: 30 October 2025 at 10:15pm
 Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
 
 
 Topic: How to get the block's length in TrackControl?
 Posted By: hellokenny
 Subject: How to get the block's length in TrackControl?
 Date Posted: 30 September 2011 at 12:03am
 
 
        
          | Hi, all, 
 I'm using the C# sample code for TrackControl,
 
 I want to get the block's length, my code is
 
 XtremeReportControl.ReportRecord R = wndTrackControl.Records[2];
 XtremeReportControl.TrackControlItem T = (XtremeReportControl.TrackControlItem)R[3];
 MessageBox.Show(T.BlockCount.ToString());
 MessageBox.Show(T.Block[0].Length.ToString());
 
 T.BlockCount is 5, it's OK. But the T.Block[0].Length shows error.
 
 Could anyone help me?
 
 Thanks!
 
 |  
 
 Replies:
 Posted By: Xander75
 Date Posted: 05 October 2011 at 9:27am
 
 
        
          | Hi, 
 Below is some VB code that can be used to get the length of the block, hopefully you can port this to C#.
 
 
 | Private Sub TrackControl_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)
 Select Case TrackControl.HitTest(x, y).ht
 Case xtpHitTestBlock
 Debug.Print TrackControl.HitTest(x, y).Block.Length
 End Select
 
 End Sub
 
 | 
 
 Hope this helps.
 
 
 -------------
 Product: Xtreme SuitePro (ActiveX) v15.3.1
 Platform: Windows 7 64-bit (SP1) Professional Edition
 Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
 |  
 Posted By: hellokenny
 Date Posted: 11 October 2011 at 11:51pm
 
 
        
          | Hi, Xander, 
 Thank you for your answer.
 
 But I want to get all block's length in the TrackControl, this way is not suitable for me
 
 Anyway, thank you very much.
 
 
 |  
 Posted By: Xander75
 Date Posted: 13 October 2011 at 3:45am
 
 
        
          | Hi, 
 It looks like there's no way to iterate through each Block within the TrackControl, the only thing I could find was "For Each Block In TrackControl.SelectedBlocks", but this is only useful if you select the blocks first.
 
 It looks like if you require this you'll need to put in a request for this functionality.
 
 
 -------------
 Product: Xtreme SuitePro (ActiveX) v15.3.1
 Platform: Windows 7 64-bit (SP1) Professional Edition
 Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
 |  
 Posted By: hellokenny
 Date Posted: 18 October 2011 at 2:28am
 
 
        
          | Hi, 
 I tried this before, but this is not I want. Thanks.
 
 |  
 Posted By: Xander75
 Date Posted: 03 May 2012 at 9:49am
 
 
        
          | Hi, 
 I know this has been a while but I have found a way to interact with the Blocks after they're created.
 
 In VB I created a global variable as "Dim Block() As TrackBlock"
 
 Then as I added each block initially I added them to this variable incrementing the Object array each time, therefore once created you have access to the blocks lengths at anytime and you can iterate through the entire block collection.
 
 I have only found this out as I am trying to do something similar for the following post:  http://forum.codejock.com/forum_posts.asp?TID=19708&title=trackcontrol-using-markup - http://forum.codejock.com/forum_posts.asp?TID=19708&title=trackcontrol-using-markup
 
 
 -------------
 Product: Xtreme SuitePro (ActiveX) v15.3.1
 Platform: Windows 7 64-bit (SP1) Professional Edition
 Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
 |  
 
 |