<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-5497912287259847249</atom:id><lastBuildDate>Tue, 17 Nov 2009 14:58:19 +0000</lastBuildDate><title>C# Programming Reference</title><description></description><link>http://c-sharp-programming.blogspot.com/</link><managingEditor>noreply@blogger.com (Niko)</managingEditor><generator>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-8998803210644671827</guid><pubDate>Sun, 07 Dec 2008 23:40:00 +0000</pubDate><atom:updated>2008-12-07T15:45:12.031-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>base64</category><category domain='http://www.blogger.com/atom/ns#'>crypto</category><category domain='http://www.blogger.com/atom/ns#'>how to</category><category domain='http://www.blogger.com/atom/ns#'>c#</category><title>Is Base64String</title><description>This is a function to check is the string base64 string or not.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public static bool IsBase64String(string s)&lt;br /&gt;{&lt;br /&gt;    if ((s.Length % 4) != 0)&lt;br /&gt;    {&lt;br /&gt;        return false;&lt;br /&gt;    }&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        MemoryStream stream = new MemoryStream(Convert.FromBase64String(s));&lt;br /&gt;        return true;&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        return false;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;keys: c#, base64, crypto,&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-8998803210644671827?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/12/is-base64string.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-5505691846961027271</guid><pubDate>Thu, 21 Aug 2008 19:30:00 +0000</pubDate><atom:updated>2008-10-24T12:33:22.734-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Assembly</category><category domain='http://www.blogger.com/atom/ns#'>Reflection</category><category domain='http://www.blogger.com/atom/ns#'>c#</category><category domain='http://www.blogger.com/atom/ns#'>Guid</category><title>How to get C# Assembly GUID</title><description>&lt;span style="font-weight: bold;"&gt;How to get C# Assembly GUID using Reflection&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;public string AssemblyGuidString(System.Reflection.Assembly assembly)&lt;br /&gt;{&lt;br /&gt;  object[] objects =&lt;br /&gt;assembly.GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), false);&lt;br /&gt;  if (objects.Length &gt; 0)&lt;br /&gt; {&lt;br /&gt;   return ((System.Runtime.InteropServices.GuidAttribute)objects[0]).Value;&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;   return String.Empty;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;keys: c#, assembly, reflection, guid, attributes&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-5505691846961027271?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/08/how-to-get-c-assembly-guid.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>5</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-7071870161660768738</guid><pubDate>Wed, 16 Jul 2008 15:39:00 +0000</pubDate><atom:updated>2008-07-16T09:00:58.083-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Errors</category><category domain='http://www.blogger.com/atom/ns#'>c#</category><category domain='http://www.blogger.com/atom/ns#'>threading</category><title>Cross-thread operation not valid: Control 'xxxxx' accessed from a thread other than the thread it was created on.</title><description>This exception is thrown when you try to access control from thread other than the thread it was created on.&lt;br /&gt;To access control and control properties use &lt;span style="font-weight: bold;"&gt;delegate&lt;/span&gt;. Its easy. Here is example for accessing Label control (label1) Text property.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;delegate void updateLabelTextDelegate(string newText);&lt;br /&gt;private void updateLabelText(string newText)&lt;br /&gt;{&lt;br /&gt; if (label1.InvokeRequired)&lt;br /&gt; {&lt;br /&gt;     // this is worker thread&lt;br /&gt;     updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabelText);&lt;br /&gt;     label1.Invoke(del, new object[] { newText });&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;     // this is UI thread&lt;br /&gt;     label1.Text = newText;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Now whenever you want to change text of label you call method &lt;b&gt;updateLabelText(newText).&lt;/b&gt; You can do the same for all other controls.&lt;br /&gt;&lt;br /&gt;keys: gui multithreading,  update from another thread, threading, cross-thread,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-7071870161660768738?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/07/cross-thread-operation-not-valid.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>11</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-8686731797354722141</guid><pubDate>Mon, 23 Jun 2008 06:05:00 +0000</pubDate><atom:updated>2008-06-22T23:20:52.489-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>asp.net</category><category domain='http://www.blogger.com/atom/ns#'>how to</category><title>Set proxy for WebRequest in web.config</title><description>Put this in web.config, you can set usesystemdefault but for me that dont work.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;system.net&amp;gt;&lt;br /&gt;  &amp;lt;defaultproxy&amp;gt;&lt;br /&gt;    &amp;lt;proxy&lt;br /&gt;      usesystemdefault="false"&lt;br /&gt;      proxyaddress="http://192.168.1.1:3128"&lt;br /&gt;      bypassonlocal="true"&lt;br /&gt;    &amp;lt;/proxy&amp;gt;&lt;br /&gt;  &amp;lt;/defaultproxy&amp;gt;&lt;br /&gt;&amp;lt;/system.net&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;Keys: asp.net, webrequest, proxy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-8686731797354722141?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/06/set-proxy-for-webrequest-in-webconfig.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-8733386739270743406</guid><pubDate>Mon, 23 Jun 2008 03:40:00 +0000</pubDate><atom:updated>2008-06-23T09:32:09.200-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Errors</category><category domain='http://www.blogger.com/atom/ns#'>tsql</category><category domain='http://www.blogger.com/atom/ns#'>c#</category><title>RESTORE cannot process database because it is in use by this session</title><description>&lt;span style="font-weight: bold;"&gt;"System.Data.SqlClient.SqlError: RESTORE cannot process database because it is&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;in use by this session. It is recommended that the master database be used&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;when performing this operation.&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;If you are using Microsoft.SqlServer.SMO set SqlServer.ConnectionContext.DatabaseName to "master".&lt;br /&gt;If you are using TSQL, select master database (USE master).&lt;br /&gt;&lt;br /&gt;Keys: error, smo, tsql, c#.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-8733386739270743406?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/06/restore-cannot-process-database-because.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-2799924230853810392</guid><pubDate>Fri, 11 Apr 2008 22:37:00 +0000</pubDate><atom:updated>2008-07-16T09:21:11.940-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Errors</category><title>C# DataGridView and Multithreading Problem</title><description>I had some problems updating &lt;span style="font-weight: bold;"&gt;datagridview&lt;/span&gt; from another thread. Problem is in painting scrollbars (vertical one). One thing that is interesting is that everything is working fine if you start your program from &lt;span style="font-weight: bold;"&gt;VisualStudio&lt;/span&gt; debugger.&lt;br /&gt;&lt;br /&gt;My first solution to this problem was: I've disabled scrollbars and application works fine.&lt;br /&gt;&lt;br /&gt;After some time of research &lt;span style="font-weight: bold;"&gt;I've found solution to my problem!!!&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;to simplify there is two posibilities:&lt;br /&gt;&lt;br /&gt;  1. you have datagridview without binded datasource&lt;br /&gt;  Solution: use delegate to add rows, or update existing.&lt;br /&gt;&lt;br /&gt;  2. you have datagridview with binded datasource (for example datatable)&lt;br /&gt;  Solution: use delegate to update datatable/datasource,&lt;br /&gt;&lt;br /&gt;if you dont now how, you can start from this &lt;a href="http://c-sharp-programming.blogspot.com/2008/07/cross-thread-operation-not-valid.html"&gt;article&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;keys: c# datagridview multithread freeze, scrollbar problem, c# application freeze, program hangup, multithread gui update, datagridview update from another thread, threading, csharp.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-2799924230853810392?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/04/datagridview-and-multithreading.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-5772774709570819525</guid><pubDate>Tue, 18 Mar 2008 20:19:00 +0000</pubDate><atom:updated>2008-03-18T13:22:30.263-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>covert</category><category domain='http://www.blogger.com/atom/ns#'>how to</category><title>How to convert string to byte[]</title><description>Here is a litle function to convert string to byte array.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public static byte[] StringToByteArray(string inputString)&lt;br /&gt;{&lt;br /&gt;  System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();&lt;br /&gt;  return encoding.GetBytes(inputString);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-5772774709570819525?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/03/how-to-convert-string-to-byte.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-6092355029013749930</guid><pubDate>Sun, 16 Mar 2008 11:55:00 +0000</pubDate><atom:updated>2008-03-16T05:09:00.892-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Errors</category><category domain='http://www.blogger.com/atom/ns#'>Exceptions</category><category domain='http://www.blogger.com/atom/ns#'>ReportViewer</category><title>Deserialization failed: The type initializer for "Microsoft.ReportDesigner.Drawing.Language" threw an exception.</title><description>I had this error because I registered custom CultureInfo with same name that already exists in collection.&lt;br /&gt;&lt;br /&gt;Above is peace of code that you can use to check if you have the same problem. If this code don't throw an exception, than you have some other problem.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;private void test()&lt;br /&gt;{&lt;br /&gt;  CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);&lt;br /&gt;  Hashtable hashtable = new Hashtable();&lt;br /&gt;  ArrayList m_languages = new ArrayList();&lt;br /&gt;  hashtable.Add("", "Default");&lt;br /&gt;  m_languages.Add("");&lt;br /&gt;  for (int i = 0; i &lt; cultures.Length; i++)&lt;br /&gt;  {&lt;br /&gt;    CultureInfo info = cultures[i];&lt;br /&gt;    if (info.Name != "")&lt;br /&gt;    {&lt;br /&gt;      hashtable.Add(info.Name, info.DisplayName);&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-6092355029013749930?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/03/deserialization-failed-type-initializer.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5497912287259847249.post-8474295652743196586</guid><pubDate>Fri, 08 Feb 2008 16:45:00 +0000</pubDate><atom:updated>2008-02-08T08:48:02.521-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>net framework</category><category domain='http://www.blogger.com/atom/ns#'>source code</category><category domain='http://www.blogger.com/atom/ns#'>programming</category><category domain='http://www.blogger.com/atom/ns#'>free application</category><category domain='http://www.blogger.com/atom/ns#'>c#</category><title>Welcome to the C# Programming Reference</title><description>I've created this blog as reference to C# programming tools, articles, and free/open source code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5497912287259847249-8474295652743196586?l=c-sharp-programming.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://c-sharp-programming.blogspot.com/2008/02/welcome-to-c-programming-reference.html</link><author>noreply@blogger.com (Niko)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item></channel></rss>