Page 1 of 2
Really need help -.-
Posted: Sun Jul 18, 2010 9:36 pm
by NeedHelp
I need help using settings:
Save whats selected in listbox
and
save whats written in a textbox
when form closes or when someone clicks a button
Re: Really need help -.-
Posted: Sun Jul 18, 2010 10:09 pm
by Livengood
my.settings.SETTINGNAME = textbox1.text
my.settings.save
or
my.settings.SETTINGNAME = listbox1.text
my.settings.save
and for the closeing of the form -
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
End Sub
Re: Really need help -.-
Posted: Sun Jul 18, 2010 10:34 pm
by NeedHelp
Listbox thing didnt work, release source?
Re: Really need help -.-
Posted: Sun Jul 18, 2010 10:56 pm
by Scottie1972
my.settings.SETTINGNAME = listbox1.SelectedText
or
my.settings.SETTINGNAME = listbox1.SelectedItem.ToString
my.settings.save()
Re: Really need help -.-
Posted: Sun Jul 18, 2010 11:02 pm
by NeedHelp
It doesnt go back to the selected one when i open it
Re: Really need help -.-
Posted: Sun Jul 18, 2010 11:35 pm
by Scottie1972
you have to connect the ListBox with the Setting
Form_Load Event
ListBox1.Selected= my.settings.SETTINGNAME
something like that
Re: Really need help -.-
Posted: Sun Jul 18, 2010 11:38 pm
by Scottie1972
look post your script so that we can see what you are trying to do.
It will give us a better idea of what is going on.
Re: Really need help -.-
Posted: Tue Jul 20, 2010 8:48 am
by NeedHelp
Its a listbox and i want it to save the selected item in the listbox when they click a button or close the form...
Re: Really need help -.-
Posted: Tue Jul 20, 2010 9:12 am
by mandai
Code: Select allFile.WriteAllText("selected.txt", ListBox1.SelectedItem.ToString())
File.WriteAllText("textbox.txt", TextBox1.Text)
?
Re: Really need help -.-
Posted: Thu Jul 22, 2010 2:15 pm
by GHOSTCORP
my.setting.SETTINGSNAME = textbox1.text
my.settings.save