Forum Visual C# LanguageIssues regarding the C# language and compiler – including things like generics, anonymous methods, etc.© 2009 Microsoft Corporation. Tous droits réservés.Sat, 28 Nov 2009 22:30:17 Zee0ba90b-2020-4d46-848e-7278d11047e8http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/938378c3-f472-4d5c-9caf-a48598530244http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/938378c3-f472-4d5c-9caf-a48598530244VeeredWalkerhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=VeeredWalkerDataGridView QuestionEvery time (well once every half second) the user changes text in a textbox, the current datagridview is completely replaced with a new datatable. The problem is that even when I use ClearSelection right after I assign the new DataTable to the DataGridView, the first row is selected. Anyone know how to stop this?Sat, 28 Nov 2009 22:30:16 Z2009-11-28T22:30:17Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/81ed6e87-b2b9-4943-9693-f3263b0246ddhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/81ed6e87-b2b9-4943-9693-f3263b0246ddJoseph261http://social.msdn.microsoft.com/Profile/fr-FR/?user=Joseph261KeyPressed Backspace EventI have a textbox that is searching an array and displaying the results each time a key is passed.  This is handled in the KeyChanged event.  However, in the KeyPressed event it is set to clear the array and listbox when the textbox is cleared by using the &quot;BackSpace&quot; key.  This works, but the BackSpace key has to be pressed one extra time after clearing the textbox.  Any advice would be helpful.Sat, 28 Nov 2009 22:03:07 Z2009-11-28T22:03:08Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/7c390cc1-84bd-4efd-b930-3cb80740c25chttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/7c390cc1-84bd-4efd-b930-3cb80740c25cH.HEMDAN ISMAILIA - EGYPThttp://social.msdn.microsoft.com/Profile/fr-FR/?user=H.HEMDAN%20%20%20%20%20%20%20%20ISMAILIA%20-%20EGYPTHow can i bind the Table Identity to Textbox control on win form <pre lang="x-c#">string connstring3 = ConfigurationManager.AppSettings.Get(&quot;GrandMotorsConnection&quot;); string query3 = &quot;SELECT IDENT_CURRENT('OrdersIN') AS Current_Identity&quot;; SqlConnection conni3 = new SqlConnection(connstring3); SqlCommand cmd3 = new SqlCommand(query3, conni3); SqlDataAdapter da3 = new SqlDataAdapter(query3, conni3); DataSet ds3 = new DataSet(); da3.Fill(ds3,&quot;OrdersIN&quot;); OrderIDtextbox.DataBindings.Add(&quot;text&quot;, ds3, &quot;Current_Identity&quot;); OrderIDtextbox.DataBindings.Clear();</pre> this gives me null textbox ,,, how can i do that <br/><br/>thanks for help anyway <br/><br/>Sat, 28 Nov 2009 19:20:52 Z2009-11-28T21:16:35Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/145e4e08-46d3-4550-a1b4-a7e30fdddf66http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/145e4e08-46d3-4550-a1b4-a7e30fdddf66shayke23http://social.msdn.microsoft.com/Profile/fr-FR/?user=shayke23problem binding TextBox to DataSet<span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:12px;line-height:15px"> <table border=0 cellspacing=0 cellpadding=0 width="100%"> <tbody> <tr style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:10pt;line-height:1.2em"> <td style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:9pt;line-height:1.25em;background-color:#edf8ff" colspan=2>hi there,<br/>i am trying to bind a textBox with a MS-SQL table fiels in this way:<br/><br/> <pre style="background-color:#fbedbb;font:normal normal normal 9pt/normal 'Courier New', Courier, mono;white-space:pre;overflow-x:auto !important;overflow-y:auto !important;padding:7pt">dataAdapter.Fill(dataSet, tableName);<br/>textBox.DataBindings.Add(<span class=code-string style="color:purple">&quot;</span><span class=code-string style="color:purple">Text&quot;</span>, dataSet.Tables[tableName], <span class=code-string style="color:purple">&quot;</span><span class=code-string style="color:purple">someField&quot;</span>);</pre> <br/><br/>the thing is, that while using <code style="color:#990000;font:normal normal normal 11pt/normal 'Courier New', Courier, mono">dataAdapter.Fill()</code> method, the textBox is really filled...BUT when i am making changes in the textBox the modification doesn't reflect in the DB.<br/><br/>what am i missing in order to make this bind 2-way???<br/><br/>thx!</td> </tr> </tbody> </table> </span>Sat, 28 Nov 2009 02:11:23 Z2009-11-28T18:54:23Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/17170af0-a4af-4ef0-a465-e10b422e4d5fhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/17170af0-a4af-4ef0-a465-e10b422e4d5fpaintlax21http://social.msdn.microsoft.com/Profile/fr-FR/?user=paintlax21Grid ClickerI need the soruce code for a grid clicker like this one<br/><br/><a href="http://www.glsoft.co.uk/gridclicker/">http://www.glsoft.co.uk/gridclicker/</a><br/><br/>but all the people i ask the source code say it was coded in c++<br/><br/>can anyone help me with one for c#Sat, 28 Nov 2009 18:20:25 Z2009-11-28T18:20:26Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/928a67b5-0b31-43ee-a05f-7e4dbfe8e081http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/928a67b5-0b31-43ee-a05f-7e4dbfe8e081xMignonhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=xMignonKill threads after a specific time?Hi!<br/><br/>I have implemented an ThreadPool and, since I'm running 500+ threads, I can't use the<br/>WaitHandle.WaitAll(doneevents); because it has got a limit of 64 threads. I have used the code below to solve<br/>it:<br/><br/> <pre lang="x-c#"> static bool WaitForAll(ManualResetEvent[] events) { bool result = false; try { if (events != null) { for (int i = 0; i &lt; events.Length; i++) { events[i].WaitOne(); } result = true; } } catch { result = false; } return result; }</pre> This works just fine. Now, I want to Abort all threads that is not done in 5 minutes, is this possible?<hr class="sig">Visual Studio 2008. VB.NETFri, 27 Nov 2009 12:33:48 Z2009-11-28T17:49:33Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/5ea80f3f-de25-4c11-a074-ec7d252d3a6bhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/5ea80f3f-de25-4c11-a074-ec7d252d3a6bpaintlax21http://social.msdn.microsoft.com/Profile/fr-FR/?user=paintlax21Disable Button on Different Form<p>how do i disable a button on form1 when i click a button on form2...i have tried the this.owner stuff but cant seem to get it to work</p>Sat, 28 Nov 2009 15:51:18 Z2009-11-28T16:48:11Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/f358a727-01cb-41de-9946-19ad8cc67870http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/f358a727-01cb-41de-9946-19ad8cc67870capt edgarhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=capt%20edgarbuild vb6 dll<p>Hi there,</p> <p>I have a C # application in which one of the functionality i.e. project is to build/compile vbp's i.e. visual basic project using vb6.exe</p> <p>Is there a code snippet anywhere which can help me with the above or is there a place where i can look at to start with as i'm a newbie to programming and bit very interested to fix this in the application<br/><br/>please advice</p>Sat, 28 Nov 2009 14:25:59 Z2009-11-28T14:27:24Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/9a71709c-180d-4c6b-bef0-e9a8c2b63369http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/9a71709c-180d-4c6b-bef0-e9a8c2b63369funskehttp://social.msdn.microsoft.com/Profile/fr-FR/?user=funskeCan't get a record in database with NewRow()I have hit the wall again, and many walls to follow i guess. I want to create a record in a database, which I create with the following code. The table has 4 fields and the database is SQL Compact Edition. I see the new created record in the DataGridView on my Windows Form. When I leave the program and check the table in the database nothing is created. The update() of the tableadapter should do this according to my book. Does anybody know what I am doing wrong in the code below ?<br/><br/><span style="font-size:xx-small"><font size=1> <p> </p> </font></span> <p><span style="font-size:xx-small;color:#2b91af"><span style="font-size:xx-small;color:#2b91af">DataTable</span></span><span style="font-size:xx-small"> dt = spyMaster2DataSet.Agent;<br/></span><span style="font-size:xx-small;color:#2b91af"><span style="font-size:xx-small;color:#2b91af">DataRow</span></span><span style="font-size:xx-small"> dr = dt.NewRow();<br/>dr[0] = 20 + i; <br/>dr[1] = </span><span style="font-size:xx-small;color:#a31515"><span style="font-size:xx-small;color:#a31515">&quot;K&quot;</span></span><span style="font-size:xx-small">;<br/>dr[2] = </span><span style="font-size:xx-small;color:#a31515"><span style="font-size:xx-small;color:#a31515">&quot;zzz&quot;</span></span><span style="font-size:xx-small">;<br/>dr[3] = </span><span style="font-size:xx-small;color:#a31515"><span style="font-size:xx-small;color:#a31515">&quot;38334&quot;</span></span><span style="font-size:xx-small">;<br/>dt.Rows.Add(dr);<br/>dt.AcceptChanges();<br/>spyMaster2DataSet.AcceptChanges();<br/>agentTableAdapter.Update(spyMaster2DataSet.Agent);<br/>i++;</span></p>Fri, 27 Nov 2009 22:42:29 Z2009-11-28T14:23:00Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/0a1b68ef-86dc-4789-98dc-4c007f71da97http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/0a1b68ef-86dc-4789-98dc-4c007f71da97arsalancheemahttp://social.msdn.microsoft.com/Profile/fr-FR/?user=arsalancheemaremoving empty line haaving jsut white spacehi,<br/>  <br/> i am reading a file line by line<br/> <br/> there are some lines coming with nothing but white space so they are not considered as null.<br/> <br/> How can i get rid of them??<br/> <br/> Thanks. Fri, 27 Nov 2009 17:21:02 Z2009-11-28T15:57:14Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/6d324cdc-75a5-46e6-aaea-08fc84ec7a14http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/6d324cdc-75a5-46e6-aaea-08fc84ec7a14moiseswchttp://social.msdn.microsoft.com/Profile/fr-FR/?user=moiseswcgenerating buttons(more than 1 row)Hi,<br/>i'm generating buttons through programing(not by design), like this:<br/><br/> <pre lang="x-c#"> ButtonArray = new System.Windows.Forms.Button[10]; int x; for (x = 1; x &lt;= 8; x++) { ButtonArray[x] = new System.Windows.Forms.Button(); ButtonArray[x].Location = new System.Drawing.Point(x * 25 + 25, 430); ButtonArray[x].Size = new System.Drawing.Size(20, 20); ButtonArray[x].Text = x.ToString(); this.Controls.Add(ButtonArray[x]); }</pre> but all the buttons are showing in one row like this:<br/>1 2 3 4 5 6 7 8 .<br/><br/>how can i show them with two or more rows like this:??<br/>1 2 3 4<br/>5 6 7 8<br/><br/>thanksSat, 28 Nov 2009 01:58:22 Z2009-11-28T18:49:01Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/20fa9907-afb1-4845-8f0d-29b87b37c23chttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/20fa9907-afb1-4845-8f0d-29b87b37c23cRajivDotNethttp://social.msdn.microsoft.com/Profile/fr-FR/?user=RajivDotNetupcastHi all,<br/><br/>I bit confused about the Upcasting of the object, please conside the sample below:<br/><br/> <pre lang="x-c#"> class Program { static void Main(string[] args) { DeriveClass x = new DeriveClass(); x.someProperty = &quot;Some Value&quot;; BaseClass y; y = x; } } public class BaseClass { } public class DeriveClass : BaseClass { public string someProperty; }</pre> Here when we assign the object of derived class to the base class variable, Are we losing the data for the &quot;someProperty&quot; property as object y doesn't hold the value for &quot;someProperty&quot; ? if yes , then why doesn't the compiler give an error for this? <br/><br/><br/><br/>Thanks,<br/>RajivSat, 28 Nov 2009 06:45:53 Z2009-11-28T07:48:11Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/db1fad0d-3dd9-4fb0-b844-d37c879a1f1chttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/db1fad0d-3dd9-4fb0-b844-d37c879a1f1cLunatikkhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=LunatikkHow do I retrieve all ResourcesHello,<br/> <br/> <br/> How do I get all Resource elements from Properties.Resources?<br/> I can get those from Properties.Settings.Default with gettype().GetProperties(), but this ain't working for Resources.<br/> <br/> Any ideas?<br/> <br/> regards,<br/> L.<br/><hr class="sig">&quot;veritas vos liberabit&quot;Fri, 27 Nov 2009 16:54:44 Z2009-11-27T17:11:42Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/19b266ba-4854-4aa8-b66d-ea42875a7cdfhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/19b266ba-4854-4aa8-b66d-ea42875a7cdfH.HEMDAN ISMAILIA - EGYPThttp://social.msdn.microsoft.com/Profile/fr-FR/?user=H.HEMDAN%20%20%20%20%20%20%20%20ISMAILIA%20-%20EGYPTHow can i format the Value that in Textbox after bind it to some Database Value ???i have Textbox for Date and for Number okay and its bind its Data from Database so <br/><br/>my Textbox for Date show me the value with some way i didnt want How can i format it to become with that   2009/11/25 as example <br/><br/>and how i can format the number Textbox that bind a Money Value from  3000.000  to become Double or anything like that 3000.50  as exampleThu, 26 Nov 2009 22:15:55 Z2009-11-27T16:52:22Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/bfca8747-fea8-42cd-8cbe-e78ee7462ef7http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/bfca8747-fea8-42cd-8cbe-e78ee7462ef7YKiranKumarhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=YKiranKumarWindows Service Start Failure error..All,<br/><br/> I'm getting an error message like &quot;Cannot start service from the command line or a debugger. A windows service must frist be be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.&quot; when I started debugging my service from VS 2008 Professional Edition. Following is how I using my 'OnStart(...)' method:<br/><br/>private bool IsStarted = true;<br/>private NotificationProcessBusiness notificationProcess = null; // Initializes in CTOR<br/><br/>...<br/><br/>protected override void OnStart(string[] args)<br/>{ <br/>   if (IsStarted)<br/>   {<br/>      notificationProcess.StartNotificationProcess();<br/>      IsStarted = false;<br/>   }<br/>}<br/><br/>...<br/><br/>I am not sure why this error is occuring. I googled all sites but no idea about the solution. <br/><br/>Please can some one help me in resolving this problem.<br/><br/><hr class="sig">Kiran (www.ggktech.com)Mon, 19 Oct 2009 09:03:14 Z2009-11-27T15:31:09Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/5bb6015c-5d09-48d0-929a-d9243ab24abahttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/5bb6015c-5d09-48d0-929a-d9243ab24abaVladimir Nskhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=Vladimir%20NskCalling C functions with variable number of arguments from C# using PInvoke<p>We want to call C functions with variable number of arguments from C# using PInvoke. Here’s an example:</p> <p>The C declaration with variable number of arguments looks something like this:<br/>int SetValue(void*, int, ...);</p> <p>We found that one way is to provide a C# declaration using __arglist:<br/>[DllImport(&quot;sample.dll&quot;, CallingConvention = CallingConvention.Cdecl]<br/>static extern int SetValue(IntPtr desc, int param, __arglist);<br/>and then call:<br/>SetValue(desc, parameter, __arglist(value));</p> <p>We are reluctant to use the __arglist methodology because we can’t find it documented anywhere. Is it officially supported?<br/><br/>Thanks,<br/> Vladimir</p>Fri, 27 Nov 2009 14:06:28 Z2009-11-27T15:24:35Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/de5c8635-4cd3-4c52-a268-9983aa94dd5chttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/de5c8635-4cd3-4c52-a268-9983aa94dd5cRicardo M.S.http://social.msdn.microsoft.com/Profile/fr-FR/?user=Ricardo%20M.S.Order String<p>Good afternoon,</p> <p><br/>   I'm trying to create a structure with the following objective</p> <p>  The first from a file is read the following set of data and order .</p> <p> </p> <p><br/>//File exer.txt<br/>Items<br/>f,a,c,d,g,i,m,p<br/>a,b,c,f,l,m,o<br/>b,f,h,j,o<br/>b,c,k,s,p<br/>a,f,c,e,l,p,m,n</p> <p> </p> <p><br/>file = &quot;C:\\exer.txt&quot;;</p> <p>           <br/>            StreamReader sr = new StreamReader(ficheiro);</p> <p>        <br/>           while ((line = sr.ReadLine()) != null)<br/>            {<br/>              ....  <br/>            }</p> <p>          C = List_Ini.Where(num =&gt; num.count &gt; 2).OrderByDescending(num =&gt; num.count).ToList() ;</p> <p><br/>//List_Ini order by count<br/>f<br/>c<br/>a<br/>m<br/>p<br/>b</p> <p><br/>what is needed in each lina order according to the order of the list. I am not able to do this   <br/>for example<br/>line 1:f,a,c,d,g,i,m,p<br/>order: f,c,a,m,p</p> <p><br/>Thanks</p> <p><br/>line 2:a,b,c,f,l,m,o<br/>order: f,c,a,b,m</p> <p><br/>thanks</p> <p>  </p>Fri, 27 Nov 2009 14:51:47 Z2009-11-28T13:48:35Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/90e581cc-adca-4a3a-8438-cd1073b11edehttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/90e581cc-adca-4a3a-8438-cd1073b11edearsalancheemahttp://social.msdn.microsoft.com/Profile/fr-FR/?user=arsalancheemainstallation pack for windows forms applicationHi,<br/> <br/> I 2 windows forms application, which take some input files and make new files at specific location in C drive. I want to know is there any way to make an installation pack for making those folders in C:\ and placing the icon of exe at desktop.<br/> <br/> Any kind of Tips tricks and suggestions are welcomed.<br/> <br/> Thanks a lot indeed.<br/> <br/> Best RegardsFri, 27 Nov 2009 14:11:04 Z2009-11-27T15:48:21Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/71233754-1468-49d5-bd99-5a9cfbdd8233http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/71233754-1468-49d5-bd99-5a9cfbdd8233maporojohttp://social.msdn.microsoft.com/Profile/fr-FR/?user=maporojoSetting MDI Child Form Position<p>Situation:</p> <p>I am learning how to make Multiple Document Interface applications in C# using Visual Studio 2008. There are features like cascade, tile, etc. that can be used to place the child form within the parent form. I'm using show and hide properties to display only one child form at a time. They are displayed as expected but they keeping moving further and further away from location (0,0) of the parent form in the process of switching forms using command buttons. I'd like to have every child form to be at location (0,0) of the parent form so that that the active form (the one where &quot;Show&quot; is &quot;True&quot;) can be completely visible in the parent form which is just slightly bigger than all the child forms. I can always resized the parent form during program execution but that shouldn't be necessary, I think.</p> <p>Question:</p> <p>Is there a way to specify the position of a child form when showing it? E.g. what would I need to add to the following code in order to make frmchild always appear at location (0,0) or (20,10) of frmparent?</p> <p>public class frmparent<br/>{<br/> .<br/> .<br/> .</p> <p> private void FileNew_clicked(object sender, EventArgs e)<br/> {<br/>  Form frmchild=new Form();<br/>  frmchild.MDIParent=this;<br/>  frmchild.Show();<br/> }</p> <p> .<br/> .<br/> .</p> <p>}</p>Wed, 25 Nov 2009 20:13:30 Z2009-11-27T14:47:12Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/95d46a41-edc0-49c0-b847-497b48ec2e39http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/95d46a41-edc0-49c0-b847-497b48ec2e39Computer Freekhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=Computer%20FreekRandom Group NameHi,<br/> <br/> I am helping in a planning of a camp. Therefore, i planned to use a randomizer to randomize the people into respective group. This would not appears to be bias as it is computer random. I would be gald if someone could help me get the code. Please give examples. Please allow the user to select the number of groups he/she wants. I write in C# and please try not to use SQL if possible.<br/> <br/> ThanksThu, 26 Nov 2009 12:23:08 Z2009-11-27T14:37:48Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/6d61a76b-d82a-4337-9161-a1eeadbe8bc0http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/6d61a76b-d82a-4337-9161-a1eeadbe8bc0TejaswiniJhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=TejaswiniJNeed help in threads...Hi,<br/>      I have a function which I want to execute after every 2-3 seconds. This thing I tried with Timer..but in that case the UI is not responsive.. So I implemented it through thread.<br/> <br/> <pre lang="x-c#">Thread timerRefreshCache; private void Form1_Load(object sender, EventArgs e) { //some lines of code timerRefreshCache = new Thread(timer_RefreshCache_Tick); timerRefreshCache.IsBackground = true; timerRefreshCache.Start(); //some lines of code } private void timer_RefreshCache_Tick() { while (true) { try { RefreshCacheData(); if (this.InvokeRequired) { this.Invoke(new RefreshCacheUICallBack(FillUsersInGridUI)); } #region Refresh the chat window if required //Some lines of code here #endregion Thread.Sleep(2000); //I want to execute the same functions after 2 seconds interval, so I wrote Thread.Sleep(2000) } catch (Exception ex) { //code to log the exception. } } } </pre> Now, because of Thread.Sleep() ..the functionality is one. But I have a text box on the form and due to this statement, when I am writing in the texbox it's a bit sloe responding...the same case for clearing the textbox.<br/> <br/> So, my question is...<br/> 1.  Is &quot;Thread.Sleep()&quot; is sleeping the application thread..instead of the created thread.. &quot;timerRefreshCache&quot; ?<br/> 2.And what is the replacement for THread.Sleep(..) if it's sleeping the main thread.. as I want to timerRefreshCache.sleep(..)<br/> <br/> can anybody tell me the solution?<br/> Plz..it's urgent !!Fri, 27 Nov 2009 05:41:08 Z2009-11-28T03:01:55Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/f01ef776-fed6-4129-ba4c-266ab18cd38fhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/f01ef776-fed6-4129-ba4c-266ab18cd38fSrinivaaS Birlangihttp://social.msdn.microsoft.com/Profile/fr-FR/?user=SrinivaaS%20BirlangiC#.net code for IO StreamReader to read data from .txt file for smartphone 6<div>Sorry to my English....i am new to this.</div> Hi Sir/Madam! <div>Present i am working on windows mobile 6(smartphone) on c#.net, i am facing problem when i using stream reader(read the text from .txt file).Why because......actually when we were using stream reader with windows application we will give the full path of that text file(&quot;c:\documents\sri.txt&quot;) , but in this windows mobile application we will give text file name(&quot;sri.txt&quot;) only.If how can this application(windows mobile) find this file path,where we will save/put the text file, and please give me suitable code for read the data from .txt file and explanation of above my questions.</div> <div><br/></div> <div> Thank you sir/madam.</div> <div> Once again sorry to my English.</div>Thu, 19 Nov 2009 11:56:25 Z2009-11-27T12:35:19Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/ad225567-891e-49f7-92ed-b38bc30b2576http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/ad225567-891e-49f7-92ed-b38bc30b2576334-jamesbond007http://social.msdn.microsoft.com/Profile/fr-FR/?user=334-jamesbond007sitecollection creation <p>hi<br/>i am new to sharepoint</p> <p>so please provide me the complete walk through of creating a sitecollection using c# code in vs 2005 by creating a webpart .</p>Fri, 27 Nov 2009 05:47:12 Z2009-11-27T12:17:46Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/b36a8b9a-ef6d-4e03-aff8-dfb95107ea60http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/b36a8b9a-ef6d-4e03-aff8-dfb95107ea60accord16http://social.msdn.microsoft.com/Profile/fr-FR/?user=accord16Please help to fix the HRESULT: 0x8007007E error<span style="font-family:Arial;font-size:9pt" lang=EN-US> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US>Hi all:</span></span></p> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US> I am using Visual Studio 2005. I had written some coding as follow:</span></span></p> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System.Collections.Generic;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System.ComponentModel;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System.Data;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System.Drawing;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System.Text;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System.Windows.Forms;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US>using</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> System.Runtime.InteropServices;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:green;font-size:xx-small"><span style="font-family:細明體;color:green;font-size:9pt" lang=EN-US></span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:blue;font-size:xx-small"><span style="font-family:細明體;color:blue;font-size:9pt" lang=EN-US><br/>namespace</span></span><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> WindowsApplication1</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>{</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>    <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">partial</span></span> <span style="color:blue"><span style="color:blue">class</span></span> <span style="color:#2b91af"><span style="color:#2b91af">Form1</span></span> : <span style="color:#2b91af"><span style="color:#2b91af">Form</span></span></span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>    {</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">bool</span></span> CAMexist = <span style="color:blue"><span style="color:blue">false</span></span>;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">struct</span></span> <span style="color:#2b91af"><span style="color:#2b91af">DEVMGR_DEVICE_INFORMATION</span></span></span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        {</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">uint</span></span> dwSize;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span> hDevice;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span> hParentDevice;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            [<span style="color:#2b91af"><span style="color:#2b91af">MarshalAs</span></span>(<span style="color:#2b91af"><span style="color:#2b91af">UnmanagedType</span></span>.ByValTStr, SizeConst = 6)]</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">string</span></span> szLegacyName;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            [<span style="color:#2b91af"><span style="color:#2b91af">MarshalAs</span></span>(<span style="color:#2b91af"><span style="color:#2b91af">UnmanagedType</span></span>.ByValTStr, SizeConst = 260)]</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">string</span></span> szDeviceKey;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            [<span style="color:#2b91af"><span style="color:#2b91af">MarshalAs</span></span>(<span style="color:#2b91af"><span style="color:#2b91af">UnmanagedType</span></span>.ByValTStr, SizeConst = 260)]</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">string</span></span> szDeviceName;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            [<span style="color:#2b91af"><span style="color:#2b91af">MarshalAs</span></span>(<span style="color:#2b91af"><span style="color:#2b91af">UnmanagedType</span></span>.ByValTStr, SizeConst = 260)]</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">string</span></span> szBusName;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        }</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">enum</span></span> <span style="color:#2b91af"><span style="color:#2b91af">DeviceSearchType</span></span> : <span style="color:blue"><span style="color:blue">int</span></span></span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        {</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            DeviceSearchByLegacyName = 0,</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            DeviceSearchByDeviceName = 1,</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            DeviceSearchByBusName = 2,</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            DeviceSearchByGuid = 3,</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            DeviceSearchByParent = 4</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        }</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">static</span></span> <span style="color:blue"><span style="color:blue">readonly</span></span> <span style="color:#2b91af"><span style="color:#2b91af">Guid</span></span> GuidCamera = <span style="color:blue"><span style="color:blue">new</span></span> <span style="color:#2b91af"><span style="color:#2b91af">Guid</span></span>(<span style="color:#a31515"><span style="color:#a31515">&quot;CB998A05-122C-4166-846A-933E4D7E3C86&quot;</span></span>);</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        [<span style="color:#2b91af"><span style="color:#2b91af">DllImport</span></span>(<span style="color:#a31515"><span style="color:#a31515">&quot;coredll.dll&quot;</span></span>)]</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">static</span></span> <span style="color:blue"><span style="color:blue">extern</span></span> <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span> FindFirstDevice(</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        [<span style="color:#2b91af"><span style="color:#2b91af">In</span></span>] <span style="color:#2b91af"><span style="color:#2b91af">DeviceSearchType</span></span> searchType,</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:green"><span style="color:green">//[In] int searchType,</span></span></span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        [<span style="color:#2b91af"><span style="color:#2b91af">In</span></span>] <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span> searchParam,</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        [<span style="color:#2b91af"><span style="color:#2b91af">In</span></span>, <span style="color:#2b91af"><span style="color:#2b91af">Out</span></span>] <span style="color:blue"><span style="color:blue">ref</span></span> <span style="color:#2b91af"><span style="color:#2b91af">DEVMGR_DEVICE_INFORMATION</span></span> pdi);</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        [<span style="color:#2b91af"><span style="color:#2b91af">DllImport</span></span>(<span style="color:#a31515"><span style="color:#a31515">&quot;coredll.dll&quot;</span></span>)]</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">public</span></span> <span style="color:blue"><span style="color:blue">static</span></span> <span style="color:blue"><span style="color:blue">extern</span></span> <span style="color:blue"><span style="color:blue">int</span></span> FindClose([<span style="color:#2b91af"><span style="color:#2b91af">In</span></span>] <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span> hFindFile);</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">public</span></span> Form1()</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        {</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            InitializeComponent();</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        }</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        <span style="color:blue"><span style="color:blue">private</span></span> <span style="color:blue"><span style="color:blue">void</span></span> timer1_Tick(<span style="color:blue"><span style="color:blue">object</span></span> sender, <span style="color:#2b91af"><span style="color:#2b91af">EventArgs</span></span> e)</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        {</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span> handle = <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span>.Zero;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:#2b91af"><span style="color:#2b91af">DeviceSearchType</span></span> searchType = <span style="color:#2b91af"><span style="color:#2b91af">DeviceSearchType</span></span>.DeviceSearchByGuid;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:#2b91af"><span style="color:#2b91af">IntPtr</span></span> searchParam = <span style="color:#2b91af"><span style="color:#2b91af">Marshal</span></span>.AllocHGlobal(<span style="color:#2b91af"><span style="color:#2b91af">Marshal</span></span>.SizeOf(<span style="color:blue"><span style="color:blue">typeof</span></span>(<span style="color:#2b91af"><span style="color:#2b91af">Guid</span></span>)));</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:#2b91af"><span style="color:#2b91af">Marshal</span></span>.StructureToPtr(GuidCamera, searchParam, <span style="color:blue"><span style="color:blue">false</span></span>);</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:green;font-size:xx-small"><span style="font-family:細明體;color:green;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:#2b91af"><span style="color:#2b91af">DEVMGR_DEVICE_INFORMATION</span></span> di = <span style="color:blue"><span style="color:blue">new</span></span> <span style="color:#2b91af"><span style="color:#2b91af">DEVMGR_DEVICE_INFORMATION</span></span>();</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            di.dwSize = (<span style="color:blue"><span style="color:blue">uint</span></span>)<span style="color:#2b91af"><span style="color:#2b91af">Marshal</span></span>.SizeOf(<span style="color:blue"><span style="color:blue">typeof</span></span>(<span style="color:#2b91af"><span style="color:#2b91af">DEVMGR_DEVICE_INFORMATION</span></span>));</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            handle = FindFirstDevice(searchType, searchParam, <span style="color:blue"><span style="color:blue">ref</span></span> di);</span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:green;font-size:xx-small"><span style="font-family:細明體;color:green;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:green;font-size:xx-small"><span style="font-family:細明體;color:green;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:green;font-size:xx-small"><span style="font-family:細明體;color:green;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;color:green;font-size:xx-small"><span style="font-family:細明體;color:green;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">if</span></span> (CAMexist == <span style="color:blue"><span style="color:blue">true</span></span>)</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            {</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>                CAMtextBox.Text = <span style="color:#a31515"><span style="color:#a31515">&quot;Camera exist&quot;</span></span>;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            }</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            <span style="color:blue"><span style="color:blue">else</span></span></span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            {</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>                CAMtextBox.Text = <span style="color:#a31515"><span style="color:#a31515">&quot;Camera not exist&quot;</span></span>;</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>            }</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>        }</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>    }</span></span></p> <p class=MsoNormal><span style="font-family:細明體;font-size:xx-small"><span style="font-family:細明體;font-size:9pt" lang=EN-US>}</span></span><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US></span></span></p> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US>After compile, I run it under debug mode. An error occur at FindFirstDevice with HRESULT: 0x8007007E. What should I do to fix it?</span></span></p> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US> </span></span></p> <p class=MsoNormal><span style="font-family:Arial;font-size:xx-small"><span style="font-family:Arial;font-size:9pt" lang=EN-US>I am just a novice in Visual Studio and the project is under pressure in time. Please help.<br/><br/></span></span></p> </span>Fri, 27 Nov 2009 11:42:51 Z2009-11-27T11:42:51Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/48bcea49-336a-4192-bc38-5c6ca0a0c185http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/48bcea49-336a-4192-bc38-5c6ca0a0c185Lunatikkhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=LunatikkThe process cannot access the file because it is being used by another processHello there,<br/> <br/> I created a little app that basically watches over the file system and if a specific file is created does stuff with the file.<br/> I'm having a little problem here.<br/> First, if a file was created, the Filewatcher eventhandler gets active.<br/> After this and some other steps I try to create a XMLReader with the path of the new file (the same path, that the filewatcher watches).<br/> But at this point I get the IOexception &quot;The process cannot access the file 'D:\blah\file.xml' because it is being used by another process&quot;.<br/> <br/> However if I add a messagebox in the filewatcher or a Thread.sleep(), I get no error message.<br/> <br/> My guess is, that the file watcher somehow still has exclusive control to the file or filepath and so the XMLReader can't retrieve it.<br/> If I add a pause in between, the file watcher &quot;has enough time to release the filepath or the file&quot;. (please excuse my wording)<br/> <br/> Could somebody explain to me what the reason to this problem is?<br/> <br/> Info: Filewatcher and XMLReader are in differen classes (filewatcher static method in static class and XMLReader Method of class instance).<br/> <br/> <br/> regards,<br/> <br/> <br/> L.<br/><hr class="sig">&quot;veritas vos liberabit&quot;Wed, 25 Nov 2009 21:22:05 Z2009-11-27T10:06:48Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/3d4d2eb0-2f49-485d-ba99-1e5fa77d7599http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/3d4d2eb0-2f49-485d-ba99-1e5fa77d7599ananda vardhanahttp://social.msdn.microsoft.com/Profile/fr-FR/?user=ananda%20vardhanaHow to use BigInteger in C#<p>The following c# sample program on VS2005 gives the following error:<br/><br/>No overload for method 'BigInteger' takes '1' arguments<br/><br/>Could this be because of vjslib.dll? I have J# installed. Anyway that is a dll, is there any lib to be used? Or any reference to be done? My .Net is 2.0, should I go tp .net 4.0? Would that help? <br/><br/><br/><br/>using System;<br/>using System.IO;<br/>using Microsoft.CSharp;</p> <p>namespace Test<br/>{<br/>    class BigInteger<br/>    {<br/>        static void Main(string[] args)<br/>        {<br/>            BigInteger bigIntFromDouble = new BigInteger(179032.6541);<br/>            Console.WriteLine(bigIntFromDouble);<br/>            BigInteger bigIntFromInt64 = new BigInteger(934157136952);<br/>            Console.WriteLine(bigIntFromInt64);<br/>        }<br/>    }<br/>}</p>Wed, 25 Nov 2009 01:30:08 Z2009-11-27T09:54:37Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/94cf92ac-dd19-4479-8a7d-c4856777f567http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/94cf92ac-dd19-4479-8a7d-c4856777f567funskehttp://social.msdn.microsoft.com/Profile/fr-FR/?user=funskeBinarySearch array, can't get it to find anything case insensitive<span style="font-size:xx-small"><font size=1> <p>Hi, I have an array and I want to search this array based on the input of a textbox (txtSearch).<br/>This works but only if I type it exactly as it is stored in the array. But I want it to search case insensitive<br/><br/>This is my line of code (sortedSt is an array, txtSearch.Text is input). <br/><br/><em>theIndex = </em></p> </font></span> <p><span style="font-size:xx-small;color:#2b91af"><span style="font-size:xx-small;color:#2b91af"><em>Array</em></span></span><span style="font-size:xx-small"><em>.BinarySearch(sortedSt,0,sortedSt.Length,txtSearch.Text);<br/><br/></em>What should I add to let it search case insensitive ? </span></p> <p><span style="font-size:xx-small">TIA</span></p> <p> </p>Thu, 26 Nov 2009 13:47:03 Z2009-11-27T09:51:00Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/57410a83-ab0e-4827-8e7b-ae1af334523chttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/57410a83-ab0e-4827-8e7b-ae1af334523cmeetjaydeep3http://social.msdn.microsoft.com/Profile/fr-FR/?user=meetjaydeep3Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154I have created web application in that I am using Excel Functionalities<br/> When I run the app I got this error<br/> <span style="font-weight:bold;font-size:x-small;color:red;font-family:Arial"><br/> Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154<br/> <br/> </span> I have found one solution <a title=here href="http://blog.crowe.co.nz/archive/2006/03/02/589.aspx" title=here>here</a> <br/> but for this Excel is needed and In my system Excel is not installed <br/> <br/> Please help me to solve this problem. <hr class="sig">Regards,<br/> <a href="http://www.google.com/profiles/meetjaydeep">Jaydeep</a>Wed, 21 Oct 2009 12:58:16 Z2009-11-27T09:09:21Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/20d2f540-8f58-408b-adb3-cac8c5632fe2http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/20d2f540-8f58-408b-adb3-cac8c5632fe2arsalancheemahttp://social.msdn.microsoft.com/Profile/fr-FR/?user=arsalancheemaregex helpHi,<br/> <br/> I am using following regex in C#. but i am getting error message &quot;ArgumentException was unhandled&quot;<br/> <br/>  Regex test1 = new Regex(@&quot;^\[*(.*?)\]*(+|-|*|/).*&quot;);<br/> <br/> i am trying to match following<br/> <br/> [  -4,  -4,  -4,  -4,  -4,  -4,  -3,  -2,  -0,   0,   0 ] + Heat.levl_min;<br/> <br/> starting with &quot;[&quot;  followed by anything, followed by &quot;]&quot; followed by  &quot;+&quot;or&quot;-&quot;or&quot;*&quot;or&quot;/&quot;   followed by anything, followed by &quot;;&quot;<br/> <br/> <br/> <br/> Any suggestion please??<br/> <br/> Regards<br/> <br/> <br/> <br/> <br/>Thu, 26 Nov 2009 16:56:40 Z2009-11-27T08:44:33Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/ab48701f-37c0-4e97-a1f7-c0f5999e6128http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/ab48701f-37c0-4e97-a1f7-c0f5999e6128CSharpLeaderhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=CSharpLeadertcpListener.Server.ReceiveTimeout doesn't work as expectedThough I set the tcpListener.Server.ReceiveTimeout TIMEOUT 5 seconds, it doesn't work and keep waiting foreever. Could you please tell me what is wrong there?<br/> <br/>                 IPAddress localAddress = IPAddress.Parse(&quot;127.0.0.1&quot;);<br/>                 TcpListener tcpListener = new TcpListener(localAddress, serverPort);                <br/>                 tcpListener.Server.ReceiveTimeout = 5000;<br/>                 tcpListener.Start();<br/>                 TcpClient tcpClient = tcpListener.AcceptTcpClient();                               <br/>                 tcpClient.Close();<br/>                 tcpListener.Stop();<br/> <br/> Thanks.Fri, 27 Nov 2009 05:16:31 Z2009-11-27T07:58:25Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/d36624c6-98ad-4fbf-a858-781dc1a3db33http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/d36624c6-98ad-4fbf-a858-781dc1a3db33meetjaydeep3http://social.msdn.microsoft.com/Profile/fr-FR/?user=meetjaydeep3Problem in File Upload with Tamperdata pluginI want to upload txt files.<br/> For this I have placed CustomValidator which checks the extension of the file.<br/> But, with <a title=TamperData href="https://addons.mozilla.org/en-US/firefox/addon/966" title=TamperData>tamperdata</a> plugin if i change the file name of the upload file CustomValidator's ServerValidate event will not execute.<br/> Please help me on this issue.<br/> <pre lang="x-c#">private void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args) { string UploadFileName = FileUpload.PostedFile.FileName; if(UploadFileName == &quot;&quot;) { // There is no file selected args.IsValid = false; } else { string Extension = UploadFileName.Substring(UploadFileName.LastIndexOf('.') + 1).ToLower(); if (Extension == &quot;txt&quot;) { args.IsValid = true; // Valid file type } else { args.IsValid = false; // Not valid file type } } }</pre> <hr class="sig">Regards,<br/> <a href="http://www.google.com/profiles/meetjaydeep">Jaydeep</a>Fri, 27 Nov 2009 07:16:12 Z2009-11-27T07:16:13Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/bb5b4f96-58f2-45a3-9c8e-f13f2bf13e2bhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/bb5b4f96-58f2-45a3-9c8e-f13f2bf13e2barsalancheemahttp://social.msdn.microsoft.com/Profile/fr-FR/?user=arsalancheemaquit application if bool = false:: help reqHi,<br/> <br/> I have generated a windows forms application in c#. At the start i want to put a check.<br/> <br/>  If bool cond = false  i want to display messagebox and quit that application and<br/> <br/>  if bool is true then it must run normally.<br/> <br/> Any suggestion??<br/> <br/> Best regards.Thu, 26 Nov 2009 09:49:52 Z2009-11-27T07:29:18Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/01ee425f-16aa-4326-b7eb-f10ed175e2c4http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/01ee425f-16aa-4326-b7eb-f10ed175e2c4pepcoderhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=pepcoderHow to get the value of a LinkTextBox created at runtime<p>Hi,<br/><br/>I have a cutom control called ScrollBox( A control like a textbox) where I am creating a LinkTextBox at runtime and showing the values of the linktextbox inside the scrollbox one by separated by commas.<br/><br/>I have completed the avove part.Now My doubt is I need to iterate through the ScrollBox control and remove an item on click of a LinkTextBox<br/><br/>Somehow I have done like this..<br/><br/> private void r_bonTextBox_Service_AfterMenuItemClick(object sender, EventArgs e)----&gt;click event of the LinkTextBox created at runtime<br/>  {<br/>   for (int i = 0; i &lt; r_bonTextBox_Service.PanelMain.Controls.Count; i++)<br/>   {<br/>    LinkTextBox link = (LinkTextBox)r_bonTextBox_Service.PanelMain.Controls[i];</p> <p>       Remove(((BOLinkData)link.llLinkLabel.Tag).BOID); // remove service ID<br/>   }<br/>  }<br/><br/>Note: <br/><br/> My remove method accepts an integer as follows<br/><br/><br/><br/>public void Remove(int ServiceID)<br/>{<br/> //code to delete the selected item from the textox <br/>  <br/>}<br/>     <br/>But <strong>r_bonTextBox_Service.PanelMain.Controls.Count</strong> (Name of my ScrollBox is r_bonTextBox_Service)  returns 0 if I run the above piece of code. Can anybody suggest an alternative method to achieve the same?<br/><br/><br/>Thanks in advance<br/><br/>Pep</p>Wed, 25 Nov 2009 13:23:17 Z2009-11-27T06:41:26Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/0fc20665-79bc-4b0f-855d-13deb17256cchttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/0fc20665-79bc-4b0f-855d-13deb17256ccB1juhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=B1juCompare two XML SchemaHi,<br/><br/>   I have a standard XML schema file, and i need to compare an another schema file with the standard Schema file programatically(C#).<br/><br/>Can anyone please suggest me some solution?<br/><br/>With regards<hr class="sig">Biju Software Engineer,MCP Thu, 26 Nov 2009 11:15:35 Z2009-11-27T06:35:51Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/3cf5b584-b536-442d-9c0d-48432ea32ebehttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/3cf5b584-b536-442d-9c0d-48432ea32ebeShreesh Onkarhttp://social.msdn.microsoft.com/Profile/fr-FR/?user=Shreesh%20OnkarCan we dynamically create Stored queries ( or simply queries) in MS Access using C#?I am facing problem with regard to creating stored queries in MS Access dynamically (at runtime using C# and VS 2005). I have been searching since 2 days but havnt got any related info. Can anybody plz tell me the way to do it??  Actually, I wanted to create Access database, tables and stored queries in MS Access using C#. I am done with first two but only last one is remaining. If this is not the right forum for this query, please suggest the right forum to ask the same.<br/><br/>Thanks in advance<br/>Shreesh OnkarWed, 25 Nov 2009 09:33:00 Z2009-11-27T06:30:25Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/4f844d37-74c2-49ea-b978-042d3394141bhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/4f844d37-74c2-49ea-b978-042d3394141bharini_pavihttp://social.msdn.microsoft.com/Profile/fr-FR/?user=harini_paviWindows ServiceHow  to  create a windows service to clear the event log. Can anyone help me out ???Wed, 25 Nov 2009 04:43:47 Z2009-11-27T06:01:32Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/6e4668a9-0e9a-4175-919f-71d60cfec710http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/6e4668a9-0e9a-4175-919f-71d60cfec710Joseph261http://social.msdn.microsoft.com/Profile/fr-FR/?user=Joseph261Need to "re"-search an xml file each time a key is pressed while textbox is the focus<p>I am trying to figure out the most efficient way to search a file in such a way as to make it seem like a &quot;real-time&quot; search; while the textbox is the focus, each time a character key is pressed the search is run again.  For example, if the letter &quot;h&quot; is pressed, immediately returns all values containing &quot;h&quot;.  If &quot;e&quot; is pressed next, immediately returns all values containing &quot;he&quot;.  If backspace is pressed next, immediately reverts to values containing &quot;h&quot;.  Thank you for any and all who are able to help!</p>Fri, 27 Nov 2009 01:35:56 Z2009-11-27T05:13:11Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/cebe94de-1488-4d17-98e6-e7b583bcd821http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/cebe94de-1488-4d17-98e6-e7b583bcd821__MDS__http://social.msdn.microsoft.com/Profile/fr-FR/?user=__MDS__Changing Calendar Type in DateTimePicker ? Hi all.<br/> Is it possible to change type of calendar in DateTimePicker ?<br/> e.g : I'm gonna replace Persian Calendar with the default calendar in DateTimePicker !<br/> Thanks<hr class="sig">Beauty is a great God blessing Tue, 24 Nov 2009 19:06:51 Z2009-11-27T07:57:03Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/e5113a46-10a5-4477-b934-534cb9e3df12http://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/e5113a46-10a5-4477-b934-534cb9e3df12salom123http://social.msdn.microsoft.com/Profile/fr-FR/?user=salom123c# excel range.FormulaArrayhi, can anyone tell me why this does not work<br/> <br/>  Excel.Worksheet ws_res = (Excel.Worksheet)<br/>                   wb.Worksheets.Add(mis, mis, mis, mis);<br/>   Excel.Range range_res = (Excel.Range)ws_res.get_Range(&quot;A1&quot;,&quot;HM232&quot;);<br/>  range_res.FormulaArray = <br/>            &quot;=ROUND((IF((IF(Sheet4!A1:HM232=1,0,&quot;+<br/>            &quot;IF(Sheet4!A1:HM232=0,1,Sheet4!A1:HM232)))=1,0,&quot;+<br/>            &quot;IF((IF(Sheet4!A1:HM232=1,0,&quot;+<br/>            &quot;IF(Sheet4!A1:HM232=0,1,Sheet4!A1:HM232)))=0,1,(&quot;+<br/>            &quot;IF(Sheet4!A1:HM232=1,0,&quot;+<br/>            &quot;IF(Sheet4!A1:HM232=0,1,Sheet4!A1:HM232)))))),0)&quot;;<br/> <br/> but this does<br/> <br/>    Excel.Worksheet ws_res = (Excel.Worksheet)<br/>                   wb.Worksheets.Add(mis, mis, mis, mis);<br/>   Excel.Range range_res = (Excel.Range)ws_res.get_Range(&quot;A1&quot;,&quot;HM232&quot;);<br/>   range_res.FormulaArray = <br/>   &quot;=ROUND((IF(Sheet4!A1:HM232=1,0,IF(Sheet4!A1:HM232=0,1,Sheet4!A1:HM232))),0)&quot;;<br/> <br/> =======================================================<br/> <br/> but if i copy and paste the above two formulas to the formula bar of excel-2007 and press Ctrl+Shift+Enter, both work perfectly!<br/> <br/> =======================================================<br/> <br/> i have also changed in the above two formulas A1:HM232 to R1C1:R232C221, again from c# the shorter one works fine, but the longer one still generates the exception!<br/>Fri, 26 Jun 2009 20:25:44 Z2009-11-27T01:32:37Zhttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/cb78b9f8-f93c-4373-a805-b0dc90a853cchttp://social.msdn.microsoft.com/Forums/fr-FR/csharplanguage/thread/cb78b9f8-f93c-4373-a805-b0dc90a853ccDynamichttp://social.msdn.microsoft.com/Profile/fr-FR/?user=DynamicHow would you deserialize an xml when you don't know its type?!<div>Is it something impossible?</div> <div><br/></div> I have an XSD file from which I have created classes using xsd.exe. There are over 20 different classes. <div><br/></div> <div>I receive a string data containing the xml and I have to deserialize it to use the object later.</div> <div><br/></div> <div>At the time of deserialization, I don't know what type that string data would be, so how could I deserialize this xml?!</div> <div><br/></div> <div>One awful approach would be to use try/catch for every class of my XSD which are 20, then finally finding out the deserialized object.</div> <div><br/></div> <div>Any idea?</div> <div><br/></div>Thu, 26 Nov 2009 23:02:06 Z2009-11-26T23:02:06Z