Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

Vote on your favorite hash algorithm here!

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-05-2007, 07:10 AM
McMillan0520 McMillan0520 is offline
Newbie
 
Join Date: Aug 2007
Posts: 4
Credits: 0
Rep Power: 0
McMillan0520 is on a distinguished road
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 12:48 PM. Reason: -
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-08-2007, 11:52 AM
McMillan0520 McMillan0520 is offline
Newbie
 
Join Date: Aug 2007
Posts: 4
Credits: 0
Rep Power: 0
McMillan0520 is on a distinguished road
Default

Right, I fixed it. The problem was in a completely different part of the code. I used the same thread reference twice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Drivers TcM Computer Hardware 6 08-19-2007 05:34 PM
how to update another table at the same command button? hanarina21 Visual Basic Programming 4 03-27-2007 03:03 PM
Automatic update for copyright Jaan PHP Tutorials 0 03-05-2007 02:52 AM
Member Interviews UpDate xXHalfSliceXx Member Interviews 0 11-27-2006 01:55 AM
Update how often? Nightracer Search Engine Optimization 12 08-01-2006 09:56 AM


All times are GMT -5. The time now is 11:22 AM.

Contest Stats

Xav ........ 1335.07
MeTh0Dz|Reb0rn ........ 1059.99
morefood2001 ........ 898.18
John ........ 887.37
marwex89 ........ 875.28
WingedPanther ........ 864.22
Brandon W ........ 764.23
chili5 ........ 312.39
Steve.L ........ 256.16
dcs ........ 231.11

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 83%

Ads