dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: [RESOLVED] Not able to retrieve and compare value from list

  1. #1
    Join Date
    Sep 2010
    Posts
    26

    [RESOLVED] Not able to retrieve and compare value from list

    Trying to do a search on a windows form on ISBN. When I do the search, it does not locate the value, although the bin folder does show the value in there.

    Code:
                    //IList<Book> listBooks = new List<Book>();
                    Book book = new Book();
                    string fISBN = FindISBNTxt.Text;
                    BookMgr bookMgr = new BookMgr();
                    bookMgr.FindBook(book);
                    Book fdBook = bookMgr.FindBook(book);
                    if (String.Equals(fISBN, fdBook))
                    {
                        MessageBox.Show(book.title + " has been found!");
                    }
                    else
                    {
                        MessageBox.Show(book.title + " is not in list!");
                    }
    Code:
        public class BookSvcBinImpl : IBookService
        {
            public Book RetrieveBook()
            {
                FileStream loadStream = new FileStream("Book.bin", FileMode.Open, FileAccess.Read);
                IFormatter formatter = new BinaryFormatter();
                Book bookX = formatter.Deserialize(loadStream) as Book;
                loadStream.Close();
                return bookX;
            }
    Code:
        public class BookMgr : Manager
            public Book FindBookMgr() 
            {
                //Factory factory = new Factory();
                IBookService bookSvc = (IBookService)GetService(typeof(IBookService).Name);
                bookSvc.RetrieveBook();
                Book bookF = bookSvc.RetrieveBook();
                return bookF;
            }
    Last edited by mtn*rain; October 20th, 2010 at 08:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)