Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed

    Question [Help]Save track bar settings[Solved]

    I'm trying to figure out how to save my Track bar settings the user chooses, its a slider to adjust the time it takes to inject. Made it in VB 2010 Exp. I want to know the easiest fastest way to do it within the project and it not have to rely on outside sources. If its not possible then just give me the quickest easiest way. I've tried My.Settings method but I just can't seem to get it to work could someone give me a code or a link on how to do it please I've been stuck on it all day!!!!

  2. #2
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    .ini file, or my.settings.

  3. #3
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed
    lolland I know dude but thats what I'm doing My.Settings but I can't get it to work think you could TV me maybe?

  4. #4
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    Try writing it to an .ini file.

    It's as easy as this: https://www.mpgh.net/forum/33-visual-...ml#post1964448

  5. The Following User Says Thank You to Lolland For This Useful Post:

    jajarem64 (06-17-2010)

  6. #5
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed
    This is what I got. I've tried diffrent codes. Tell me what I need to add or can you just mod the code and paste it.
    Code:
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            If TrackBar1.Value = My.Settings.RemInjectTime Then
                My.Settings.RemInjectTime = TrackBar1.Value
                My.Settings.Save()
                My.Settings.Reload()
            End If
                My.Settings.Save()
                My.Settings.Reload()
    But I would rather have it in just the app I don't want any outside files
    Last edited by Obama; 06-17-2010 at 04:40 PM.

  7. #6
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Use this code. Just tested it and works fine:

    First save the settings as you scroll the track bar:

    Code:
    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
    My.Settings.RemInjectTime = TrackBar1.Value
    My.Settings.Save()
    My.Settings.Reload()
    End Sub
    Then when the application is loaded, reload the setting and assign its value to track bar 1:

    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If Not My.Settings.RemInjectTime = vbNullString Then
    TrackBar1.Value = My.Settings.RemInjectTime
    End If
    End Sub
    Hope this helps !!

  8. The Following User Says Thank You to Hassan For This Useful Post:

    jajarem64 (06-17-2010)

  9. #7
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed
    OMFG thank you!!!!! tears OF JOY!!!!!!!!!

  10. #8
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by jajarem64 View Post
    OMFG thank you!!!!! tears OF JOY!!!!!!!!!
    Haha, No problem. Glad to help you

  11. #9
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed

    Exclamation

    Oh and there is something else I could use some help on my slider is not changing the time for it I thought this would be the right way to do it.
    Code:
        Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
            My.Settings.RemInjectTime = TrackBar1.Value
            My.Settings.Save()
            My.Settings.Reload()
    
            If TrackBar1.Value = 0 Then
                Form2.Timer1.Interval = 5
                If TrackBar1.Value = 1 Then
                    Form2.Timer1.Interval = 10
                    If TrackBar1.Value = 2 Then
                        Form2.Timer1.Interval = 20
                        If TrackBar1.Value = 3 Then
                            Form2.Timer1.Interval = 30
                            If TrackBar1.Value = 4 Then
                                Form2.Timer1.Interval = 40
                                If TrackBar1.Value = 5 Then
                                    Form2.Timer1.Interval = 50
                                    If TrackBar1.Value = 6 Then
                                        Form2.Timer1.Interval = 60
                                        If TrackBar1.Value = 7 Then
                                            Form2.Timer1.Interval = 70
                                            If TrackBar1.Value = 8 Then
                                                Form2.Timer1.Interval = 80
                                                If TrackBar1.Value = 9 Then
                                                    Form2.Timer1.Interval = 90
                                                    If TrackBar1.Value = 10 Then
                                                        Form2.Timer1.Interval = 100
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End Sub

  12. #10
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored
    Shouldn't you be using ElseIf?

  13. #11
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed
    If I am supposed to be using ElseIf then OOOOPS :P and if it works tyVM!

    Well it says it has to be followed by a preceeding ElseIf

    Someone post the code in here for me please I'm totally confused rofl like I said I'm just a VB beginner.
    Last edited by Lolland; 06-17-2010 at 05:45 PM.

  14. #12
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by jajarem64 View Post
    Oh and there is something else I could use some help on my slider is not changing the time for it I thought this would be the right way to do it.
    Code:
        Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
            My.Settings.RemInjectTime = TrackBar1.Value
            My.Settings.Save()
            My.Settings.Reload()
    
            If TrackBar1.Value = 0 Then
                Form2.Timer1.Interval = 5
                If TrackBar1.Value = 1 Then
                    Form2.Timer1.Interval = 10
                    If TrackBar1.Value = 2 Then
                        Form2.Timer1.Interval = 20
                        If TrackBar1.Value = 3 Then
                            Form2.Timer1.Interval = 30
                            If TrackBar1.Value = 4 Then
                                Form2.Timer1.Interval = 40
                                If TrackBar1.Value = 5 Then
                                    Form2.Timer1.Interval = 50
                                    If TrackBar1.Value = 6 Then
                                        Form2.Timer1.Interval = 60
                                        If TrackBar1.Value = 7 Then
                                            Form2.Timer1.Interval = 70
                                            If TrackBar1.Value = 8 Then
                                                Form2.Timer1.Interval = 80
                                                If TrackBar1.Value = 9 Then
                                                    Form2.Timer1.Interval = 90
                                                    If TrackBar1.Value = 10 Then
                                                        Form2.Timer1.Interval = 100
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End Sub
    You need to use Else-If command. Right now what ya doing is telling the program that if Trackbar 1's value is 0 then execute rest of the conditional statements.

    Use this sub:

    [php]Private Sub SetTrackbar(ByVal trackbar As TrackBar, ByVal val As Integer, ByVal interval As Integer)
    If trackbar.Value = val Then
    form2.Timer1.Interval = interval
    End If
    End Sub[/php]

    Then I would call it in the trackbar_scroll event as:
    [php]SetTrackbar(TrackBar1,0,5)
    SetTrackbar(TrackBar1,1,10)[/php]

    And so on...

    The final trackbar_scroll even code should be like this:
    [php]Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
    My.Settings.RemInjectTime = TrackBar1.Value
    My.Settings.Save()
    My.Settings.Reload()
    SetTrackbar(TrackBar1,0,5)
    SetTrackbar(TrackBar1,1,10)
    'Add rest of them yourself !!!
    End Sub
    [/php]

    Also you can use loops for it if necessary, but I think this would solve your problem.

    EDIT: When you post something, then please wait for an answer. We are not always looking at your posts only. If you don't get a reply PM / VM some user you know can solve your problem. But don't bump as it can lead you to a ban !!!
    Last edited by Hassan; 06-17-2010 at 05:39 PM.

  15. The Following User Says Thank You to Hassan For This Useful Post:

    jajarem64 (06-17-2010)

  16. #13
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed
    Yeah sorry for the bumping I don't have a edit button to edit my post and thanks for the help again

  17. #14
    jajarem64's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Sarasota, FL - USA
    Posts
    318
    Reputation
    -13
    Thanks
    17
    My Mood
    Relaxed
    It seems to still be doing the same wait time (50) even tho I changed it to 100 to test if it would be slower.

  18. #15
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by jajarem64 View Post
    It seems to still be doing the same wait time (50) even tho I changed it to 100 to test if it would be slower.
    50 = 50 milliseconds
    100 = 100 milliseconds


    1000 = 1 second

    So any value less than 1000 will be in milliseconds...So it will go very fast. But indeed its changing !!!

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help] Saving resources to disk?[Solved]
    By master131 in forum Visual Basic Programming
    Replies: 3
    Last Post: 12-16-2010, 02:22 AM
  2. [Help]Save Contents of TextBox[Solved][Closed]
    By bayley60 in forum Visual Basic Programming
    Replies: 2
    Last Post: 07-17-2010, 03:06 PM
  3. [Help] Save Items in Combobox[Solved]
    By FatCat00 in forum Visual Basic Programming
    Replies: 8
    Last Post: 04-13-2010, 04:01 AM
  4. [Help]Saving Settings of a form[solved]
    By poneboy00 in forum Visual Basic Programming
    Replies: 9
    Last Post: 03-20-2010, 09:18 AM
  5. [Help]Save Text to Desktop[Solved]
    By ppl2pass in forum Visual Basic Programming
    Replies: 8
    Last Post: 03-16-2010, 08:45 AM