HomeProductsSupportDownloadsOnline StoreOnLine DocumentationLicensingAbout UsContact Us

Need technical support or assistance?

Click Here.

Please remember to read our guidelines first.

 

 

You will receive advance information about products and web updates as well as free software and source code that we will soon make available.

Subscribe Now

Once your subscription is activated you will receive instructions on how to leave the list.

 
     
Hundreds of free Visual Basic source code snippets, activeX controls, tutorials, tips, projects and articles covering VB.NET and VB6! Great code on topics like MAPI, winsock programming, COM, MTS, XML, graphics, threading, timers, networking, API's and more!
Welcome to the largest single directory of ASP.NET resources. This free directory links to examples, articles, and tutorials. A searchable code library allows you to find scripts. A daily newsletter keeps you up to date on the latest submissions.
Search the best developer Web sites and hundreds of developer newsgroups... updated every thirty minutes!

TN00013 - Limiting the amount of time shown in the VB.Net ActiveGantt Scheduler Component

Applies to:
Summary:

For certain applications it might be necessary to limit the amount of time shown in the TimeLine like in the following example:

The timeline starts at 12:00 am December 12th, 2001.

And ends at 11:59 am December 12th, 2001.

The user can move between this 24 hour period using the HorizontalScrollBar. Important: using the HorizontalScrollBar is the only method of restricting the amount of time shown in the timeline.

To recreate this behaviour, on a new VB6 form place an MFC ActiveGantt control named ActiveGanttVCCtl1 and the following code:


    Private Sub ActiveGanttVBNCtl1_TimeLineChanged() Handles ActiveGanttVBNCtl1.TimeLineChanged
        Static bLoaded As Boolean
        If bLoaded = False Then
            Dim NumMinutes As Long
            TextBox1.Text = ActiveGanttVBNCtl1.TimeLineStart
            TextBox2.Text = ActiveGanttVBNCtl1.TimeLineEnd
            NumMinutes = DateDiff("n", ActiveGanttVBNCtl1.TimeLineStart, _
            ActiveGanttVBNCtl1.TimeLineEnd)
            ActiveGanttVBNCtl1.HorizontalScrollBarStart = #12/12/2001#
            ActiveGanttVBNCtl1.HorizontalScrollBarInterval = "n"
            ActiveGanttVBNCtl1.HorizontalScrollBarFactor = 5
            ActiveGanttVBNCtl1.HorizontalScrollBarSmallChange = 1
            ActiveGanttVBNCtl1.HorizontalScrollBarLargeChange = 10
            ActiveGanttVBNCtl1.HorizontalScrollBarMax = ((1440 / 5) - (NumMinutes / 5)) + 10
            ActiveGanttVBNCtl1.HorizontalScrollBarEnabled = True
            bLoaded = True
        End If
    End Sub

Because of the way the VB.Net control is drawn it cannot calculate the value of TimeLineEnd in a Form_Load procedure, so the bLoaded variable becomes necessary and the TimeLineChanged event must be used.

In this case in particular, the ActiveGantt Control will display a 24-hour period beginning on 12/12/2001 12:00AM and ending just before 12/13/2001. 1440 is the number of minutes in 24 hours, the horizontal scroll bar moves in increments of 5 minutes (because of the HorizontalScrollBarFactorproperty), and the max property setting is determined by the amount of minutes in a 24h period (divided by the HorizontalScrollBarFactor) minus the NumMinutes variable (again divided by the HorizontalScrollBarFactor). Because of the way the scroll bars work in vb.Net 10 must be added (the value of HorizontalScrollBarLargeChange).

Home | Products | Support | Downloads | OnLine Store

Online Documentation | Licensing | About Us | Contact Us

Privacy Terms of use Copyright (c)2002-2004 Source Code Store. All trademarks are property of their legal owner.