Consulting

Results 1 to 2 of 2

Thread: Aspen Visual Basic Question

  1. #1

    Aspen Visual Basic Question

    Hey everyone, new guy here. Also not that knowledgeable in coding.

    I have a question:

    In Apen I want to use a combobox to define and use a colorset for backgrounds and trendlines etc. I have made the combobox and I made Private Enum's for the colors. I am just struggling to comprehend how to make this all work.

    I will share the code:


    Private Enum windowcolors

    doesnothing = 4079584 'rgb(224, 63, 62) RED
    background1 = 11184810 'rgb(170, 170, 170) GREY
    gridcolor = 5066061 'rgb(77, 77, 77) DGREY
    noidea = 16203573 'rgb(53, 63, 247) BLUE
    End Enum

    Private Enum windowcolors2
    doesnothing = 0 'rgb(0, 0, 0) BLACK
    background1 = 0 'rgb(0, 0, 0) BLACK
    gridcolor = 5066061 'rgb(77, 77, 77) DGREY
    noidea = 16203573 'rgb(53, 63, 247) BLUE
    End Enum



    Private Sub cmdgrid_Click()
    TrendPlot1.TrendChart.Grid.Show (True)
    TrendPlot2.TrendChart.Grid.Show (True)
    TrendPlot3.TrendChart.Grid.Show (True)
    TrendPlot4.TrendChart.Grid.Show (True)
    TrendPlot5.TrendChart.Grid.Show (True)
    TrendPlot6.TrendChart.Grid.Show (True)
    End Sub

    Private Sub cmdgriduit_Click()
    TrendPlot1.TrendChart.Grid.Show (False)
    TrendPlot2.TrendChart.Grid.Show (False)
    TrendPlot3.TrendChart.Grid.Show (False)
    TrendPlot4.TrendChart.Grid.Show (False)
    TrendPlot5.TrendChart.Grid.Show (False)
    TrendPlot6.TrendChart.Grid.Show (False)
    End Sub

    Private Sub cmdkeus_Click()
    Load mdi2
    mdi2.Show

    TrendPlot1.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot1.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot1.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot1.Color = windowcolors.noidea

    TrendPlot2.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot2.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot2.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot2.Color = windowcolors.noidea
    TrendPlot3.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot3.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot3.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot3.Color = windowcolors.noidea

    TrendPlot4.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot4.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot4.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot4.Color = windowcolors.noidea

    TrendPlot5.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot5.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot5.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot5.Color = windowcolors.noidea
    TrendPlot6.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot6.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot6.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot6.Color = windowcolors.noidea


    TrendPlot1.TrendChart.Grid.Show (False)
    TrendPlot2.TrendChart.Grid.Show (False)
    TrendPlot3.TrendChart.Grid.Show (False)
    TrendPlot4.TrendChart.Grid.Show (False)
    TrendPlot5.TrendChart.Grid.Show (False)
    TrendPlot6.TrendChart.Grid.Show (False)


    End Sub


    Private Sub UserForm_Initialize()
    cmboxserver.Clear
    cmboxserver.AddItem ("NLRZA291") 'listnumber = 0
    cmboxserver.AddItem ("NLRZA290") 'listnumber = 1
    cmboxserver.AddItem ("BEEVA286") 'listnumber = 2
    cmboxserver.AddItem ("NLRZA286") 'listnumber = 3
    cmboxserver.AddItem ("BEBEAV133") 'listnumber = 4

    cmboxserver.ListIndex = 0
    colorset.Clear
    colorset.AddItem ("K1") 'listnumber = 0
    colorset.AddItem ("K2") 'listnumber = 1

    colorset.ListIndex = 0
    TrendPlot1.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot1.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot1.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot1.Color = windowcolors.noidea

    TrendPlot2.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot2.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot2.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot2.Color = windowcolors.noidea
    TrendPlot3.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot3.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot3.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot3.Color = windowcolors.noidea

    TrendPlot4.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot4.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot4.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot4.Color = windowcolors.noidea

    TrendPlot5.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot5.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot5.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot5.Color = windowcolors.noidea

    TrendPlot6.TrendChart.BackColor = windowcolors.doesnothing
    TrendPlot6.TrendChart.Grid.BackColor = windowcolors.background1
    TrendPlot6.TrendChart.Grid.gridcolor = windowcolors.gridcolor
    TrendPlot6.Color = windowcolors.noidea


    TrendPlot1.TrendChart.Grid.Show (False)
    TrendPlot2.TrendChart.Grid.Show (False)
    TrendPlot3.TrendChart.Grid.Show (False)
    TrendPlot4.TrendChart.Grid.Show (False)
    TrendPlot5.TrendChart.Grid.Show (False)
    TrendPlot6.TrendChart.Grid.Show (False)


    End Sub

  2. #2
    If VBForm.colorset.Value = "K1" Then ??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •