my.setting question

paulthepaddy

Well-known member
Joined
Apr 9, 2011
Messages
222
Location
UK
Programming Experience
Beginner
will settings hold variables and things, this is the code im trying to use but it doesn't seem to be remembering the settings, yet it will remember the other settings
VB.NET:
My.Settings.Save_one_Invoice = True
            If Me.ComboBox1.SelectedText = "Invoice_Name" Then My.Settings.Save_one_Style = (Invoice_Name)
            If Me.ComboBox1.SelectedText = "Invoice_Name TOTAL" Then My.Settings.Save_one_Style = (Invoice_Name & TOTAL)
            If Me.ComboBox1.SelectedText = "Invoice_Name £TOTAL" Then My.Settings.Save_one_Style = (Invoice_Name & "£" & TOTAL)
            If Me.ComboBox1.SelectedText = "Invoice_Name - TOTAL" Then My.Settings.Save_one_Style = (Invoice_Name & "-" & TOTAL)
            If Me.ComboBox1.SelectedText = "Invoice_Name -£TOTAL" Then My.Settings.Save_one_Style = (Invoice_Name & "-£" & TOTAL)
            If Me.ComboBox1.SelectedText = "Invoice_Name_TOTAL" Then My.Settings.Save_one_Style = (Invoice_Name & "_" & TOTAL)
            If Me.ComboBox1.SelectedText = "Invoice_Name_£TOTAL" Then My.Settings.Save_one_Style = (Invoice_Name & "_£" & TOTAL)
 
sorry forgot to mention Invoice_Name is a public Variable (it hasn't been set yet, and get declaired after this setting has been applied) BUT it is declairs before the setings is used. eg (in order they would be used
First time running at app
The setting gets applied
If Me.ComboBox1.SelectedText = "Invoice_Name TOTAL" Then My.Settings.Save_one_Style = (Invoice_Name & TOTAL)

Invoice name is set and total is set

oSaveFileAs = DirectCast(My.Settings.InvoiceSL & My.Settings.Save_one_Style & ".docx", Object)
oDoc.SaveAs(oSaveFileAs)
 
Settings don't store variables. Just like variables, settings store values. You can basically treat settings as though they were variables themselves, with the difference being that that maintain their value between sessions. If you were to explain, fully and clearly, what you're trying to achieve, then we could suggest the best way to achieve it.
 
hi jmcilhinney, now you see why i chose to make a video of what was happening last time :D.

i understand that settings are basicly a variable that remain between sessions, but what i want is for my settings to hold a string value, but that string is variable names.

details:
my application is being used for easily creating invoices for my uncles business. the vairable in question at this time are
Invoice_Name : (this hold the invoice number EG VW(Car dealer)date(00/00/00) initals(PL- Person who did the work)

TOTAL : (the total cost of the invoice)

i have a small form and their are options for how to save the invoice EG
VW110411P this is the invoice name but i would like the invoice to be saved in the folder as

(Invoice_Name & Total)
VW110411P £200

as Invoice_name is a variable and total is a variable how can i get the setting to hold these as a string but to pass them as their variable names.

if you would watch a video please tell me as it would be far easier for you to see what is going on and what i need as i can show you where stuff is coming froma nd where it has to go :D
 
Back
Top