Blaknite
June 19th, 2006, 11:53 AM
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If CustomerDocument = "1" Then
My.Settings.InvoiceNum = My.Settings.InvoiceNum + 1
Label8.Text = "IMON"
Label10.Text = My.Settings.InvoiceNum
My.Settings.InvoiceNum = Label10.Text
Else
My.Settings.QuoteNum = My.Settings.QuoteNum + 1
Label8.Text = "QMON"
Label10.Text = My.Settings.QuoteNum
My.Settings.QuoteNum = Label10.Text
End If
End Sub
I am using VB.Net 2005. It was suggested to me to use the My.Setting
function rather than to use SaveSetting/GetSetting which I had
originally planned to use.
The problem with the code I have pasted above is this:
InvoiceNum and QuoteNum are set to 0, when I run this code it does
complete the following process: 0 + 1 = 1 and then displays "1" in
Label10 just like I want it to do.
Now I want to save the new number displayed in Label10 as the new
setting value so that I can keep adding 1 to it everytime the Form2_Load
event happens.
I was told My.Setting would autosave but this does not seem to be the
case or I am just not doing something right. Can someone please help me
fix this?
Thanks
System.EventArgs) Handles MyBase.Load
If CustomerDocument = "1" Then
My.Settings.InvoiceNum = My.Settings.InvoiceNum + 1
Label8.Text = "IMON"
Label10.Text = My.Settings.InvoiceNum
My.Settings.InvoiceNum = Label10.Text
Else
My.Settings.QuoteNum = My.Settings.QuoteNum + 1
Label8.Text = "QMON"
Label10.Text = My.Settings.QuoteNum
My.Settings.QuoteNum = Label10.Text
End If
End Sub
I am using VB.Net 2005. It was suggested to me to use the My.Setting
function rather than to use SaveSetting/GetSetting which I had
originally planned to use.
The problem with the code I have pasted above is this:
InvoiceNum and QuoteNum are set to 0, when I run this code it does
complete the following process: 0 + 1 = 1 and then displays "1" in
Label10 just like I want it to do.
Now I want to save the new number displayed in Label10 as the new
setting value so that I can keep adding 1 to it everytime the Form2_Load
event happens.
I was told My.Setting would autosave but this does not seem to be the
case or I am just not doing something right. Can someone please help me
fix this?
Thanks