VB programming

Posted on 2004-11-11
Last Modified: 2013-11-13
Can anybody suggest any third party Project Management Tool which can be used as Project 2000.
I would like to have any API or DLL for this tool in VB program.
We are trying to use this any such tool to create task, for managing resources also it should have gantt chart functinality.

Question by:amiteshsinha
    LVL 1

    Accepted Solution

    There is a very very good and flexible control from DBI Technologies called Solutions::Schedule. I have been using it for over two years as a Gantt project viewer and updater and it works really fine and has a lot of features that make it very effective for you as developer and for the users of your application. Check out

    Expert Comment

    You can try the tools from Infragistics call WinSchedule

    Sam Tan

    Author Comment

    Thanks a lot.
    I tried  Solutions::Schedule. Its really good.

    Author Comment

    I am trying to use Solutions::Schedule tool.
    pamartz  , can you send me some sample code to create a schedule. I am trying to user this OCX for creating Construction schedule and generate gantt chart using that schedule.

    Thanks In advance.
    LVL 1

    Expert Comment

    Hi amiteshsinha and thanks for your acceptance !

    The next piece of code, extracted from a real working app, shows how you can populate the Control from a recordset, adding a "barcargo" property for each time bar so that you can later access the element referenced by the time bar.
    This is being used in a maintenance task planning application, in which we are representing each due date for a task with one time bar which represents one day.

    Note: "Plan" is the name of my Solutions::Schedule control in the form.

    ' This is the function that loads Scheduling information from a recordset.
    ' For each equipment, all its scheduled tasks are shown in the same line, represented by time bars.
    Private Function CargarPlanLista() As Boolean
       Dim iCo As Integer, s As String, Rs As ADODB.Recordset, hs As mHisManS
       Dim Nus As String, nSec As String, Fec As String, h As mHisMan, His As String
       Dim MarAnt As String, n As Integer, iBar As Long, iPer As Integer
       On Error GoTo NOVA
       s = MakeSQL()
       Set Rs = New ADODB.Recordset
       Rs.Open s, Cnx ' Cnx is a previously open connection
       SoyYo = True
       Do While Not Rs.EOF
          If Rs!MFunc <> MarAnt Then ' Equipment is different from previous one so make new line.
             s = ""
             s = s & Trim("" & Rs!MFunc) & ";"
             s = s & Trim("" & Rs!Descr) & ";"
             s = s & Trim("" & Rs!CodNUS) & ";"
             s = s & Trim("" & Rs!CodApl) & ";"
             iCo = Plan.AddItem(s)
             Plan.ListCargo(iCo) = Trim("" & Rs!MFunc)
             MarAnt = Rs!MFunc
          End If
         ' Note in next sentence that we are setting identical StartDate and EndDate for each task.
          iBar = Plan.AddTimeBar(iCo, 180, 1320, CDatePLAN(Rs!Fecha), CDatePLAN(Rs!Fecha))
          Nus = Trim("" & Rs!CodNUS)
          Fec = Format("" & Rs!Fecha, gMasDM4A)
          His = Trim("" & Rs!HistoriaSN)
          If IsNull(Rs!NSecu) Then nSec = 0 Else nSec = Format(Rs!NSecu, gMas0D)
          s = ""
          s = s & Trim("" & Rs!MFunc) & vbTab                'equipment code
          s = s & Trim("" & Rs!CodTar) & vbTab               'task code
          s = s & Fec & vbTab                                'date
          s = s & Trim("" & Rs!DescTar) & vbTab              'task description
          s = s & Trim(Rs!Estado) & vbTab                    'task status
          s = s & His & vbTab                                'subject to equipment history
          s = s & Nus & vbTab                                'NUS
          s = s & nSec & vbTab                               'Sequential no.
          ' Plan.BarCargo is very important: it is used later in the app to take further actions when the users moves, clicks or double-clicks a bar (ie. a task)
         ' In Plan.BarCargo we place for each time bar all the information that we need in order to refer to the task later.
          Plan.BarCargo(iCo, iBar) = s
          Select Case Rs!Estado  ' Depending on task status we set the bar's style.
             Case "P": n = 1
             Case "F": n = 2
             Case "E": n = 3
             Case "D": n = 4
          End Select
          Plan.BarStyle(iCo, iBar) = n
          Plan.BarText(iCo, iBar) = " " & Trim("" & Rs!MRC) & " "
          Plan.BarTextAlign(iCo, iBar) = 3
       Rs.Close: Set Rs = Nothing
       SoyYo = False
      ' CargarPeriodos() is a function that colors the background of the "Plan" control in different ways depending on the operational status of the equipments. I won't include it here so as not to make this answer too long. You can comment it out and I suppose everything else will work.
       If Not CargarPeriodos() Then GoTo NOVA
       CargarPlanLista = True
       Plan.ListIndex = 1
       Exit Function
       CargarPlanLista = False
       If Screen.MousePointer = vbHourglass Then Screen.MousePointer = vbDefault
       MsgBox Error$
       End Function   'CargarPlanLista

    Private Sub InitializePlan()
       With Plan
       .UseImageList = False
       .DateFormat = "M/Y"
       .TimeType = TimeDays
       .DateOffset = 2
       .RulerDays = False
       .BackColor = vbWindowBackground
       .BarSelectBorder = BarSelectRaised
       .SelectForeColor = vbHighlightText
       .SelectBackColor = vbHighlight
       .BarTextWrap = True
       .VertReposition = False
       .BarSelectBorder = BarSelectRaised
       .BarTipSize = 0
       ''' Scope of the Plan.
       ' dtpFecIni and dtpFecFin are two DatePicker controls in which the users chooses the initial and ending date that he wants to see.
       .DateStart = CDatePLAN(dtpFecIni.Value)
       .DateEnd = CDatePLAN(dtpFecFin.Value)
       .SnapToGrid = True
       .GridFrequency = 1
       ''' Title for the List part of the control
       .TitleText = "F. Code;Description;NUS;APL"
       .TitleAlign = AlignLeft
       .TitleFont = "Verdana"
       .TitleYOffset = 5
       .TitleHeight = 30
       .ListWidth = 90
       .ListColumns = 4
       .ColumnWidth(1) = 60
       .ColumnWidth(2) = 350
       .ColumnWidth(3) = 50
       .ColumnWidth(4) = 120
       .ListWidth = 60
       .DisplayOnly = False
       End With
       End Sub 'InitializePlan

    Private Sub LoadStyles()
    ' There are in my case four bar styles representing the status of the tasks:
       Dim i As Integer
       With Plan
          i = .AddBarStyle(18, 0)     'Pending task
          .StyleBackColor(i) = vbGreen
          .StyleTextXOffset(i) = 2
          .StyleEndYOffset(i) = 6
          i = .AddBarStyle(18, 0)     'Deferred task
          .StyleBackColor(i) = vbCyan
          .StyleTextXOffset(i) = 2
          .StyleEndYOffset(i) = 6
          i = .AddBarStyle(18, 0)     'Executed task
          .StyleBackColor(i) = vbBlue
          .StyleTextXOffset(i) = 2
          .StyleEndYOffset(i) = 6
          i = .AddBarStyle(18, 0)     'Discarded task
          .StyleBackColor(i) = vbRed
          .StyleTextXOffset(i) = 2
          .StyleEndYOffset(i) = 6
       End With
       End Sub

    ' next Function formats a date so as it is accepted by the Control (change to Long).
    Public Function CDatePLAN(F As Variant) As Long
    Dim F1 As Date, F2 As Date
    F1 = CDate("01/01/1900")
    F2 = CDate(F)
    CDatePLAN = (DateDiff("d", F1, F2) + 2)
    End Function

    ' Next Function makes up the SQL statement. I'll abbreviate it, but in real app it is dependent on some selection filters.

    Private Function MakeSQL() As String
       Dim s As String
       s = ""
       s = s & "SELECT a.MFunc, b.Descr, b.CodNUS, a.NSecu, b.CodApl, "
       s = s & "c.CodTar, c.Descr as DescTar, c.MRC, a.Fecha, "
       s = s & "a.Estado, b.HistoriaSN "
       s = s & "FROM tblScheduledTasks a left join tblEquiments b on "
       s = s & "a.CBuq = b.CBuq and a.MFunc = b.MFunc "
       s = s & "left join tblTaskDefinitions c on "
       s = s & "b.CodApl = c.CodApl and a.CodTar = c.CodTar "
       s = s & "WHERE "
       s = s & "a.CBuq = " & SBDNoNulo(gCBuq) & " and "
       s = s & "a.MFunc LIKE " & SBDNoNulo(Trim(txtMFunc) & "%") & " and "
       s = s & "a.Fecha >= " & FBDNoNulo(dtpFecIni.Value) & " and "
       s = s & "a.Fecha <= " & FBDNoNulo(dtpFecFin.Value) & " "
       s = s & "order by a.MFunc, a.CodTar"
       MakeSQL = s
       End Function   'MakeSQL

    Well, was long but I hope it helps.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now