-2

I wish to make it where the opacity is the same when I quit the application and reopen it to be the opacity i set it from the trackbar value... hopefully these images help...

https://i.stack.imgur.com/JNhtJ.jpg

    Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll

        Me.Opacity = TrackBar1.Value * 0.01
        Form1.Opacity = TrackBar1.Value * 0.01
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label5.Text = TrackBar1.Value
// this is the Label showing the value of track bar 1 which you'll see in the images.

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        My.Settings.Default("Settings") = "Some Value"
        My.Settings.Default.Save()
//here is the settings in properties to save the value on exit however doesn't work... any ideas? 

    End Sub
End Class

Here are my current setting i set it for now till then

    Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
        Me.Opacity = TrackBar1.Value * 0.01
        Form1.Opacity = TrackBar1.Value * 0.01
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label5.Text = TrackBar1.Value
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        If Label5.Text = TrackBar1.Value Then
            My.Settings.Opacity = TrackBar1.Value * 0.01
        End If
    End Sub
End Class
ChrisF
  • 134,786
  • 31
  • 255
  • 325
  • You're storing opacity as an `Integer` but internally it's a floating-point value (either `Single`, `Double`, or `Decimal`). Make sure you use the same datatypes everywhere. – Dai Oct 31 '16 at 02:07

1 Answers1

0

You are going to want to use the Application Settings to save that value.

this answer will hopefully help you: Best practice to save application settings in a Windows Forms Application

Community
  • 1
  • 1
kmacdonald
  • 3,381
  • 2
  • 18
  • 22
  • Alright I gave it a shot. Please look up at my coding and revise this i'm not sure what i'm doing wrong. Thanks for your help. I'm trying to learn new ways and new features to add. :) please also excuse that VB/C# i'm not really experienced in. – Komputer-Repair- Geexs Oct 31 '16 at 19:53