Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2008

Tip: Looking for answers? Try searching our database.

TextBox with memory

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrus - 28 May 2008 16:57 GMT
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.
Tom Dacon - 28 May 2008 18:17 GMT
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.
>
[quoted text clipped - 7 lines]
>
> Andrus.
parez - 28 May 2008 19:32 GMT
> I'm creating .NET 3.5 WinForms application.
>
[quoted text clipped - 6 lines]
>
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.