combobox - remember last selection

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2007
Posts: 2
Reputation: ezbie is an unknown quantity at this point 
Solved Threads: 0
ezbie ezbie is offline Offline
Newbie Poster

combobox - remember last selection

 
0
  #1
Apr 17th, 2007
My options in my combobox are added from my mdb database... what I need is for each time my form, or program for that matter loads is to have the selected option default to the option that was last selected. So essentially, I need my combo box to "remember" which record was the last one selected by the user. Can this be done, seems like it should be simple but I haven't been able to find the answer.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 16
Reputation: Ravi Singhal is an unknown quantity at this point 
Solved Threads: 0
Ravi Singhal Ravi Singhal is offline Offline
Newbie Poster

Re: combobox - remember last selection

 
0
  #2
Apr 20th, 2007
Originally Posted by ezbie View Post
My options in my combobox are added from my mdb database... what I need is for each time my form, or program for that matter loads is to have the selected option default to the option that was last selected. So essentially, I need my combo box to "remember" which record was the last one selected by the user. Can this be done, seems like it should be simple but I haven't been able to find the answer.
Hi
I have used vb.net2002 to solve ur problem I hope it will work.
I have used button to show previous selection u may use another thing according to you. The coding is following

Dim Previous As Integer = 0
Dim Current As Integer = 0
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Previous = Current
Current = ComboBox1.SelectedIndex
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(ComboBox1.Items(Previous))
End Sub
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: combobox - remember last selection

 
0
  #3
Apr 21st, 2007
It's pretty obvious, write the last value to a text file, then read that value from the text file every time you start the program.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC