.ini file, or my.settings.
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!!!!
.ini file, or my.settings.
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?
Try writing it to an .ini file.
It's as easy as this: https://www.mpgh.net/forum/33-visual-...ml#post1964448
jajarem64 (06-17-2010)
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.
But I would rather have it in just the app I don't want any outside filesCode: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()
Last edited by Obama; 06-17-2010 at 04:40 PM.
Use this code. Just tested it and works fine:
First save the settings as you scroll the track bar:
Then when the application is loaded, reload the setting and assign its value to track bar 1: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
Hope this helps !!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
jajarem64 (06-17-2010)
OMFG thank you!!!!! tears OF JOY!!!!!!!!!
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
Shouldn't you be using ElseIf?
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.
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.
jajarem64 (06-17-2010)
Yeah sorry for the bumping I don't have a edit button to edit my post and thanks for the help again
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.