TextBox with memory

  • Thread starter Thread starter Andrus
  • Start date Start date
A

Andrus

I'm creating .NET 3.5 WinForms application.

I need to create textbox which remembers last 10 entries (stores in isolated
storage) and
offers users to select them on entry just like IE auto-complete address bar.
I think I must use textBox custom AutoCompleteSource.

Where to find sample code which implements this ?

Andrus.
 
I think it's a combo box you're after. You'd populate its items collection
with the remembered text strings.

Tom Dacon
Dacon Software Consulting
 
I'm creating .NET 3.5 WinForms application.

I need to create textbox which remembers last 10 entries (stores in isolated
storage) and
offers users to select them on entry just like IE auto-complete address bar.
I think I must use textBox custom AutoCompleteSource.

Where to find sample code which implements this ?

Andrus.

the following code worked for me. also you have to change the source
of textbox to custom source.
i am using a queue. there mite be a better way to limit a queue to 10.

Dim someQ As New Queue(Of String)
Dim c As New AutoCompleteStringCollection
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click

someQ.Enqueue(TextBox1.Text)
Do While someQ.Count > 10
someQ.Dequeue()
Loop

TextBox1.Clear()
c.Clear()
c.AddRange(someQ.ToArray())


End Sub

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TextBox1.AutoCompleteCustomSource = someQ

TextBox1.AutoCompleteCustomSource = c

End Sub
 
Back
Top