Closed Thread
Results 1 to 2 of 2

Thread: Strange error in update app

  1. #1
    McMillan0520 is offline Newbie
    Join Date
    Aug 2007
    Posts
    4
    Rep Power
    0

    Question Strange error in update app

    well, I am building an update application for my project,and the way i'm checking if there are new updates is by a webBrowser. Here is the function that checks for updates (it's called by the OnDocumentCompleted event):
    Code:
    void Check()
    		{
    			
    			string content = webBrowser1.DocumentText;
    			string[] checking = content.Split('|');
    			string data = checking[1];
    			if (data != "_MTL_VERSIONS_EQUAL_")
    			{
    				ProcessData(data);
    				
    				if(MessageBox.Show("Znaleziono w internecie poprawkę, z wersji aktualnej - "+version+", na "+upVersion+". Czy chcesz ją pobrać?", "Łatki - Multitool Update", MessageBoxButtons.YesNo)==DialogResult.Yes)
    				{
    					
    					MessageBox.Show("Za chwilę rozpocznie się pobieranie i instalacja łatki.", "Łatki - Multitool Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
    					RegistryKey rejestr=Registry.CurrentUser.OpenSubKey("software\\multitool\\UpDate",true);
    					fPath = Convert.ToString(rejestr.GetValue("DownPath"));//tymczasowa zmiana
    					button2.Text="Anuluj";
    					thr=new Thread(new ThreadStart(Download));
    					thr.Start();
    				}
    				else
    				{
    					Application.Exit();
    				}
    				
    			}
    			else
    			{
    				MessageBox.Show("Nie znaleziono żadnych poprawek.","Łatki - Multitool Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
    				Application.Exit();
    			}
    			
    		}
    		
    		
    		
    		void WebBrowser1DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e)
    		{
    			thr=new Thread(new ThreadStart(Check));
    			thr.Start();
    		}
    (sorry the messages are in Polish)
    and it gives out an error:
    An unhandled exception of type 'System.InvalidCastException' occurred in System.Windows.Forms.dll

    Additional information: Specified cast is not valid.

    The error is in the line:

    string content = webBrowser1.DocumentText;

    The documentText value is string so why is it giving out the error?
    Please answer quickly.
    Last edited by McMillan0520; 08-05-2007 at 10:48 AM. Reason: -

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    McMillan0520 is offline Newbie
    Join Date
    Aug 2007
    Posts
    4
    Rep Power
    0
    Right, I fixed it. The problem was in a completely different part of the code. I used the same thread reference twice.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MySQL Update, gives no error or update
    By bbqroast in forum PHP Development
    Replies: 5
    Last Post: 07-19-2011, 05:17 AM
  2. MySQL Update Query Error
    By millsy007 in forum Database & Database Programming
    Replies: 4
    Last Post: 02-19-2009, 01:14 AM
  3. strange error in Dev C++
    By shadowhound in forum C and C++
    Replies: 1
    Last Post: 01-30-2009, 04:55 PM
  4. Strange DLL Error, creating controls
    By ChrisPepper1989 in forum C and C++
    Replies: 0
    Last Post: 02-26-2007, 02:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

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