?
Solved

How will I get the saved history of textbox (text which is previously entered) in vb.net ?

Posted on 2013-05-29
4
Medium Priority
?
396 Views
Last Modified: 2013-07-07
How will I get the saved history of textbox (text which is previously entered)  in vb.net ?

Thanks in advance
0
Comment
Question by:hc_gupta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39204478
u can use any available .Net data structure to store previous textbox values, like List, Queue, etc.
i'd create class like this:
    public class TextHistory
    {
        private List<string> history = new List<string>();
        public void Add(string text)
        {
            history.Add(text);
        }
        public IList<string> History
        {
            get { return history.AsReadOnly(); }
        }
    }

Open in new window

0
 
LVL 42

Accepted Solution

by:
sedgwick earned 2000 total points
ID: 39204501
to use it simply add a member in your winform class.
public class MyForm : Form{
private TextHistory myHistory = new TextHistory();

}

Open in new window

each time user enter text call the Add function which the textbox.Text.
whenever u need to get all previous history, simply call the property History.
if u want a more generic history object which stores different types not only string, then u can use a generic form of the history class:
    public class GenericHistory<T>
    {
        private List<T> history = new List<T>();
        public void Add(T text)
        {
            history.Add(text);
        }
        public IList<T> History
        {
            get { return history.AsReadOnly(); }
        }
    }

Open in new window


now, to declare the type of the history class use this way, this example for integer:
public class MyForm : Form{
private GenericHistory<int> myHistory = new GenericHistory<int>();

}

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question