-
- switch/case with string
by Greg McPherran
- 12 Replies
- Last post
by Coder2048
- Does C# optimize switch/case for strings in any way such that it is more efficient than a series of if-else(s) For example, the C++ compiler can use jump tables for switch/case with integers. (Note: this is not a C++ vs. C# focus, I am just using what I have seen the C++ compiler do as an example of an optimization).
Thank You
-
- Multithreading and passing arguments to new thread
by JohnC#
- 3 Replies
- Last post
by JohnC#
- I'm attempting for the first time to multithread an application in C#.
I have a method of a class receiving a collection of objects. I want to pass that collection as an argument to the newthread worker class to perform the work (asyncronously) for the calling main thread.
When I use the following syntax;
ThreadPool .QueueUserWorkItem( new WaitCallback (AsyncWriteTestTableB
-
- Reading Files from Directories Recursively
by Uday321
- 8 Replies
- Last post
by IsshouFuuraibou
- Hi All, I want to read the files(.txt & .doc) from a Folder, which may contain some Sub Folders and some files and those Sub Folders again contain some Sub-Sub Folders and Files(i.e., what ever may be the directory structure i need to read all the files from all the Folders and Sub Folders either in Depth First Search or Breadth First Search Manner...). am trying some thing like::
-
- unable to add existing project to a solution
by Mike19
- 8 Replies
- Last post
by MichaelYarbrough1975
- Hi All.
I created a solution and am trying to add an existing project to the solution.
I'm getting the following error:
Operation could not be completed. The project file ... cannot be converted. See the conversion report for details.
Also, there isn't a conversion report as far as I can see.
There's just an ok button.
Thank you!
-
- ASP.NET Website Error
by Aluria
- 8 Replies
- Last post
by OmegaMan
- I'm having a problem with my C# ASP.NET website. I have a page that contains a repeater that reads from a Access database. When you click on a button, theat data from that particular entry is suspose to be added to a Cart page. I can get it to build successfully but I get a "Object reference not set to an instance of an object" error. It has to do with the code related to the button:
-
- 800 MB analysis
by inkexit
- 1 Replies
- Last post
by OmegaMan
- I am writing an application to analyze time series data. The time series are all stored as comma delimited txt files. Some of the files are over 800 MB. I need some advice on how to approach this. The computer I am going to run the app on only has 512 MB of memory. I imagine I would need some code that reads, say, 50 MBs of the file at a time, without opening the entire file in RAM. Or does C# tak
-
- Programmatically Cancel Window Service OnStop
by Qwerty12345678
- 4 Replies
- Last post
by gkresse
- Inside the OnStop of a window service, it will do some validation. If the validation success, the window service can stop. Otherwise, the window service will continue to run.
If I throw an exception when the validation fails, for the 1st time I stop it, I will continue to run. But for the 2nd time I stop it, even the validation is false it will stop.
I would like to know how to imple
-
- How to convert a string value to a color value?
by Azurewrath
- 7 Replies
- Last post
by Azurewrath
- Hi,
I have 3 textbox controls, and whenever someone changes those values, I want to make it change the color of a picturebox.
Right now I use this code:
private void txtRed_TextChanged( object sender, EventArgs e)
{
picColor.BackColor = Color .FromArgb( Convert .ToInt32(txtRed.Text), Convert .ToInt32(txtGreen.Text), Convert .ToInt32(txtBlue.Text));
}
But it gives
-
- "this" keyword questions.
by Zlat
- 7 Replies
- Last post
by boban.s
- I have a basic question regarding "this" keyword.
I do understand that this.blah refers the current instance of an object. However, how is "this" different form
just using an object variable
SomeObject obj=new SomeObject();
obj.blah.....
this.blah....
-
- Exception catching clarification
by Chris O'Brien
- 10 Replies
- Last post
by The_Real_MBu
- I've read that there is a penalty in performance by catching exceptions. Does that mean that this code... try { return DataAccessLayer.GetCount(); } catch { return -1;} ...is slower than the code below try { return DataAccessLayer.GetCount(); } finally {} return -1; Or, is the penalty from using catch(SomeException e)
-
- What's wrong with this code?
by Jamie Thomson
- 7 Replies
- Last post
by TilakGopi
- Hello,
Complete dotnet newbie here so please be gentle OK
Can someone give me the offical explanantion of why this is valid code:
Code Snippet
using System;
using Microsoft.SqlServer.Dts.Runtime; //Reference Microsoft.SQLServer.ManagedDTS.dll for access to this namespace
namespace Conchango.Ssis
{
public class BuildPackage
{
static
-
- Reading Console Arguments Bug...
by Greg Allen
- 2 Replies
- Last post
by Fernando Nicolet
- I'm passing some command line arguments to my console app and the string[] args is combining two of the arguments together. I run something like this: blah.exe /a testing /dir "C:\" /args blah and it args[4] is C:\" /args It only happens when I have a trailing \ and then a ", but how else would I do it for a directory
-
- Slow C# Builds
by Mystagogue
- 1 Replies
- Last post
by OmegaMan
- In the days of C++ builds, I could ensure that DLLs that had not been altered, would not build again when I built the solution they belong to. But now with C#, it seems that everything a component (exe, dll) depends on is *also* rebuilt when that component is changed and built. Is there some way to stop this
As a seperate question (more narrow than the above), will there ever be a way in VS
-
- Windows Serial No
by Dreedle
- 8 Replies
- Last post
by neophy
- Apologies if this is the wrong forum. I posted on the "Where is the forum.." but no answer yet and I need to push on with this.
I can obtain the Windows serial no from WMI (Win32_OperatingSystem.SerialNo) which provides me with the serial number that is diplayed on "My Computer" properties.
My question is this:
How unique (or not) is this serial number I would hope tha
-
- Merge Excel Files
by Wilson Cheung
- 1 Replies
- Last post
by nielsvanvliet
- If Microsoft Office will NOT be installed,
can I merge Two Excel Files into One file (two separate worksheets) in C#
Thanks for any suggestions.
-
- How do I convert a 4-byte array (of type bytes) into a 4-byte floating-point?
by Furqan Farooqui
- 4 Replies
- Last post
by Furqan Farooqui
- Okay, how do I convert an array of bytes into the 4-byte floating-point number with the same binary representation
What I'm trying to do is, that when I loaded a binary file into memory, I want to be able to set the four bytes of a byte array to some values, and then retrieve the value in floating-point.
In C++, this would've been rather easy using pointers, as shown :
char buffer[4]; //
-
- Importing library
by nnakhlis
- 4 Replies
- Last post
by Chris Dunaway
- Hi,
Please help me on how to include library file into my C# poject. I need to use CXimage.lib wiht my project to convert images.
Thank you
-
- Out of memory exception
by Daniel C Garcia
- 9 Replies
- Last post
by OmegaMan
- Hi all, I have an application that generates a list of all fingerprint images in a selected folder, then goes down the list comparing each fingerprint and returns a score for each match. The first thing it does is generate an Array List of all the files. It opens the first file and copies the data into a byte array, opens the second file and does the same. Then it calls getScore(byte array 1, byte
-
- sending fax
by Hooman
- 4 Replies
- Last post
by Karthikeya Pavan Kumar .B
- hello friends i'm new in msdn forums.
sorry i'm not very good at english.
i want to know wich component or dll that i have to use for sending fax (setting com port).
can i use winfax.dll(i cant add this dll to my application "a refrence to 'path' couldnot be added. please makesure that the file is accessible, and that it is a valid assembly or com component").
tahnks for your
-
- Error message in VS 2005
by Armand2
- 6 Replies
- Last post
by Citizen on the earth
- Hi everybody i have setup various programms on my computer and then when i ve tried to relaunch VS to modify applications graphically i ve got the following error message : One or many errors have been encountered during the load of conceptor those errors are reported below some of them can be corrected by regenerating again the solution other ones with coding modifications a Microsoft.Win32.Regis
-
- System Wide Variable
by Hylton
- 9 Replies
- Last post
by Ernst Kuschke
- Hi.
I want to know what is the bast way to declare a variable that is is available throughout the system.
I have a conneciton object that is declared as static in the startup form. This can be seen by everything except a DLL that is part of the same project.
frmMain.staicVar = xyz etc.
Is there a way that the DLL can access this variable or a better way to store the variable (n
-
- SetupDiGetDeviceRegistryProperty FatalExecutionEngineError
by turbofreddan
- 5 Replies
- Last post
by Figo Fei - MSFT
- [DllImport("setupapi.dll", CharSet = CharSet.Unicode, SetLastError = true)] public static extern bool SetupDiGetDeviceRegistryProperty( IntPtr DeviceInfoSet, ref DeviceInfoData DeviceInfoData, uint Property, out uint PropertyRegDataType, out byte[] PropertyBuffer, uint PropertyBufferSize, out uint RequiredSize ); SetupDiGetDeviceRegist
-
- Threading, Delegates and a Problem
by LarryLand
- 4 Replies
- Last post
by micvos
- I'm doing a console for a tiny server application, that's why i'm trying to access a textbox in the main form from somewhere else, and therefore from another thread. This is a fragment of the code corresponding with the console's class that uses the textbox in the main form (which is received by parameter in the constructor):
class SRM_Console
{
public System.Windows.Forms. TextBox
-
- variable
by Big Bill
- 6 Replies
- Last post
by Brendan Grant
- so i make a variable in one form but i want to recall it in another but i always get a message saying that it doesnt exist in the current context
-
- Three Image Problems
by KamiKazeKiwi3
- 0 Replies
- Last post
by KamiKazeKiwi3
- I'm working with generating an image through a class and sending it from a server to a client. The original image is 1024 by 768 pixels, with 32-bit colors.
How can I change an image's pixel format The Image class has a read-only PixelFormat property. I need to be able to change my image from 32-bit colors to 24, 16, and 8 bits. Going through each pixel individually using the Bitmap GetPixel