Answer Questions
SOTY_Programmer help with DataSet.Merge
hi all. in my application i have a timer, on the timer_tick event i go to the DB and get a refreshed dataset. then i do MyDataset.Merger(NewDataSet). but - how can i know if there are changes, and if i had changes i want to let the user know it. thanks. Hi, You should use the HasChanges and AcceptChanges method of the dataset. See the example on the MSDN site: http://msdn2.microsoft.com/en-us/library/4swwh51k.aspx . Greetz, Geert Geert Verhoeven Consultant @ Ausy Belgium My Personal Blog ...Show All
mojoshaneman C# - Can't get list of outlook contacts on some machines
Hi all I'm using trying to get my app to read in all contacts in the contact folder of Outlook. I'm using the Outlook Security manager to stop the pop up warnings. Outlook version is 2002(10.2627.2625) I can create a contact in Outlook and I can use it to send an email. It's just the getting the contacts list that doesn't work. The thing is it also works on my dev machine but not on the users machine. The code I'm using: SecurityManager = new AddinExpress.Outlook.SecurityManager(); try { Outlook._Application outlookObj = new Outlook.Application(); Outlook.MAPIFolder fldContacts = (Outlook.MAPIFolder)outlookObj.Session.GetDefaultF older(Outlook.OlDefaultFolders.olFolderContacts); Outlook.Items searchFolder = fldCont ...Show All
PSCL_L_Ramirez While Loop Optimization
I have a while loop that tests the value of (A*B > SomeNumber). This while loop is repeated at the very least several million times so code efficency is very importatant. A and B do not change while the loop is running. My question is would it be more efficent to first get the product of A and B and then test that variable against SomeNumber, or does it not matter Any other tips for optimization would be helpful too, thanks in advance. I appreciate your help, although I don't think using NGen will help my program. As to your original question, if A&B don't change it might be best to extract them outside the loop. Optimizers have to guage if those variables are ...Show All
readme55555 SUCESSFUL: Thread created with delegate
I found some example code in a web page titled “How to create a thread by using Visual C#” and located here: http://support.microsoft.com/default.aspx scid=kb%3Ben-us%3B815804 The instructions in this tutorial are easy to follow and I think I followed them correctly. It took maybe 3 minutes. When I try to run the new project, it pops up the form, then a few seconds later a window titled “InvalidOperatorException was unhandled.” The Window has an option to “Copy exception detail to the clipboard” so I did that and pasted the data in below. The line of code highlighted is: this .progressBar1.Value = newval; I did it twice and obtained exactly the same results. Did I make an error Has anyone ...Show All
Raj S How do I create and use C# DLLs?
Hello all, I am trying to create my first C# DLL and I am having some difficulty. This DLL will house some common authentication functions. I will need to use the DLL functions on the front of many different C#.NET web applications. I do understand the basic concept of DLLs and thought I could just jump in and create one. So I created my DLL, added my functions, and referenced the DLL in a test web page. But when I tried to access the functions in the test app there were no functions available in the namespace. So I clearly did not create the DLL correctly. I am looking for a tutorial or a step-by-step example that I can follow. Thank you in advance for any help/references you can supply, Chris ...Show All
BIG S Having a hard time removing multi-level directories in Windows
I have been searching for a way to do this for a day now and I feel I am getting close, but I still just run into problems with readonly directories. Basically I want to remove all the directories in Documents and Settings that are not the main directories. Seems like it should be a pretty easy task but I just can't get it.. Here is my messy code.. please excuse it but i have been so busy trying different things out I haven't had a chance to clean it up much. If you can help I would really appreciate it! using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Runtime.InteropServices; using System.Management; namespace deletefolders { public clas ...Show All
Dan Mikkelsen Breakpoints, C# IDE Express Edition
How do I reset all breakpoints I am using VS C# 2005 Express Regards, Saleem Yusuf In the full version there is an option under the Debug menu item. If there's not one there, then you don't have that option. Thanks for the response. I couldn't find it. In VC++ 6.0 IDE, there is a menu item "Breakpoints..." (Alt-F9) under Edit menu. It allows you to put conditional breakpoints and also allows you to remove all breakpoints. It is a very useful feature which I use for teaching my students how to debug code. I cannot find it VC# 2005 Express Edition. OK, like I said, if it's not there, it's not there. You can also right click on an existing br ...Show All
kiran1234 What is the maximum literal address for a local file?
I thort it was 255 but when tried I found it only == 248 CHAR full LITERAL filename & path string length!!! How do I determine what the user can enter before submitting it to the OS as the intended filename The limitation depends on the OS, the character set used and the format of the file name. The defined maximum is normally considered to be approximately 260 (MAX_PATH in Win32) but it could be less. The Unicode version using a full object name is supposedly 32K total with each part limited to approximately 255 but you won't be able to use that format in .NET. Irrelevant you shouldn't hard code the value as it could change over time. There is no property or method in .NET to determine the maximal value because it var ...Show All
msdate Remove picture Box Controls
Hi all I have windows form, where in picture boxes are dynamically being created, I need to Remove all picture boxes from the form every time user clicks on the button to load new images , how can i acheive this. i tried with the following code , but it didn't worked PictureBox pic; foreach ( Control ctr in frmScreenShot.ActiveForm.Controls) { if (typeof(PictureBox)== ctr.GetType()) { ctr.Dispse(); } i also tried with this code snippet PictureBox pc; if (this.Controls.Contains(System.Windows.Forms.PictureBox )) { this.Controls.Remove(pc) ; } Welcome Each suggestion Thanks You could add another parameter to the method that gives th ...Show All
Mystery Finding installed programs/product IDs
How would I go about finding, with a C# program, which applications are installed on a computer and their corresponding product IDs We are trying to get a hold of our increasing software inventory/licensing, and I need to make some comparisons on installed applications on various machines and available/used licenses. Any ideas There is no standardized way for an application to publish the fact that it was installed an has a product ID. A possible workaround would be to enumerate the keys in the HKLM\ Software \Microsoft \Windows \CurrentVersion \Uninstall registry key. Not a BCL question, moved to the C# General forum. ...Show All
Sledgehammer Dynamically creation of control
This is the sample code: public void GetControlArray(ref CommandButton[] btArray, string ArrayName) {} public void GetControlArray(ref CheckBox[] btArray, string ArrayName) {} public void GetControlArray(ref ThirdPartyTextBox[] btArray, string ArrayName) {} public void GetControlArray(ref RadioButton [] btArray, string ArrayName) { if (btArray == null) { int i=0; tempArray = new ArrayList(); GetControlArray(this, ArrayName, " System.Windows.Forms.RadioButton "); btArray = new RadioButton [tempArray.Count]; foreach( RadioButton rb in tempArray) { btArray[i++] = rb; } } } Color Green : change to object Color Orange ...Show All
brian_j Raising events from one thread to other
Hello, I am new in C# and would appreciate any information on standard ways to raise events from worker thread (System.Threading.Thread) to the main UI thread, where the main form is created and lives. Here I interested in the events only (as they usually used within the thread scope), not Control.Invoke()/BeginInvoke(), not BackgroundWorker class, as they are more or less learnt and OK. By default, raised events go to the same thread, is it the only behavior If not, how I should redirect them into UI thread's message loop Thank you in advance. Hi, I have developed different multi-threaded applications and whenever I had the same situation then I used Invoke(). It always worked fine for me. I d ...Show All
Valery Zharkov Convert a byte array to a short array?
I have the following code that reads a number of bytes into an array then copies them into an array of shorts. // nInt16 is the number of 16 bit integers in being read in the form of bytes // br is a BinaryReader byte[] data = br.ReadBytes(nInt16 * 2); short[] arrInt16 = new short[nInt16]; Buffer.BlockCopy(data, 0, arrInt16, 0, nInt16 * 2); Is there a way, in C#, to read the data into a byte array and then "point" an array of short to it instead of copying the data Similar to what can be done in C++. (I realize that arrays in C# and C++ are totally different data structrures) Thanks. David Yes, I could do that... I do not know for sure, but somehow it seems that ...Show All
mabxsi Accessing GIF from Embedded Resource
Hi all, I am getting a NULL exception from the following code.... Assembly asm = Assembly.GetExecutingAssembly(); Bitmap backgroundImage = new Bitmap(asm.GetManifestResourceStream("bg.gif")); Is it because I am putting a GIF into a Bitmap If so, how do I extract a GIF from an embedded resource Tryst embedded resources as I said AFAIK, when you embed it, it starts with the namespace.filename.ext even if your filename is "test.bmp", it will embed it as namespace.test.bmp. At least you have it sorted now :-) Hi, and thanks for the reply. I just tested it, and it seems to use the default Namespace value you specify in the Solution properties, and not the Product Name. Ok, ignore me, I just had the URL/pathname of the ...Show All
mortiz2112 Encrypt a wmv file
As a requirement i need to read the contents of a wmv file , encrypt it and store it in the encrypted format. This file will be read at a later time , decrypted and then played.Not going into much of details i tried to encrpyt/decrypt wmv files using the technique given in the following link http://support.microsoft.com/kb/307010/EN-US .(for text files) I didnt get the exact file back when i encrypt and decrpyt it back. I also found out that it is a problem with the encoding format while streaming the file .If somebody can tell me what is the encoding format to use while streaming a wmv file it would be great. Thanks, Yuva Yuva, I think the problem with your example is that the decryption process uses StreamReade ...Show All
