Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Calculate a possible value of year 2018 (trend/slope value?)

Calculate a possible value of year 2018 (trend/slope value?)

Calculate a possible value of year 2018 (trend/slope value?)

I just have post the question in VBA but really i need in vb6, sorry.

Have a label:


Is possible to estimate the value for the year 2018?

The various labels contain the values of the work done in my office from the old years.
How to?

RE: Calculate a possible value of year 2018 (trend/slope value?)

And, from https://www.varsitytutors.com/hotmath/hotmath_help..., something like:


Option Explicit
Option Base 1

Private Sub Command1_Click()
    Dim fred(6) As Double
    fred(1) = 23
    fred(2) = 4
    fred(3) = 23
    fred(4) = 4
    fred(5) = 11
    fred(6) = 0
    MsgBox TrendNextPoint(fred)
End Sub

Public Function TrendNextPoint(fred() As Double) As Double
    TrendNextPoint = Trend(fred, UBound(fred) + 1)
End Function

Public Function Trend(arrSample() As Double, newpoint) As Double
    Dim lp As Long  
    Dim meanX As Double
    Dim meanY As Double 
    Dim xy As Double
    Dim xx As Double
    Dim m As Double
    Dim b As Double
    For lp = 1 To UBound(arrSample)
        meanX = meanX + lp
        meanY = meanY + arrSample(lp)
    meanX = meanX / (lp - 1)
    meanY = meanY / (lp - 1)
    For lp = 1 To UBound(arrSample)
        xy = xy + (lp - meanX) * (arrSample(lp) - meanX)
        xx = xx + (lp - meanX) * (lp - meanX)
    m = xy / xx
    b = meanY - m * meanX
    Trend = newpoint * m + b

End Function 

RE: Calculate a possible value of year 2018 (trend/slope value?)

Strongm, i dont know the really namesmile

The code work a like a charm!
tks for patience.


i need to rapresent the trend result with a wingding 3 font in a subitems cell of listview similar:

good trend green fonts color, arrow up
no good trend red font color, arrow down

how to?

RE: Calculate a possible value of year 2018 (trend/slope value?)

You should probably post that as a seperate question. However, the short answer is that the VB6 ListView control has a global setting for the font, so you cannot use a different font for subitems (although you can set colour separately). Nor does the Vb6 ListView support Unicode, so you can't even use Unicode arrows as an alternative.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close