I could still not make it work.
What I noticed is that if I display a messagebox in my keypress event when I run the code the messagebox displays then disappears without human intervention but the next messagebox does not?
I had to put two messageboxes one after the other in order to achieve my goal.
Pretty ugly I admit. I am missing some fundamental understanding somewhere.
I am running the code on an psion 8515, Compact Framework 3.5, OS windows CE.NET version 5.
Here is the code for anyone interested
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
if (e.KeyChar == (char)Keys.Return) // Catch carriage return from barcode
MessageBox.Show(""); // do not delete. I do not understand why but if we remove this event then the next message box does not stop.
e.Handled = true;
this.lblBarCode.Text = textBox1.Text.Trim();
if (validate_data(lblBarCode.Text) == false)
this.textBox1.Enabled = false;
switch(MessageBox.Show(" BarCode does not match, Accept BarCode ?",
"Validate BarCode", MessageBoxButtons.YesNo,
// TODO write to output file, don't forget system date !!
// TODO ignore input tidy up
// TODO write to output file, don't forget system date !!
catch (Exception z)
MessageBox.Show("Error in btnOpenSort_Click" + z);
private Boolean validate_data(string scannedData)
int i = 0;
lineData = this.lstBoxFiles.SelectedItem.ToString();
i = lineData.IndexOf("-") + 1;
lineData = lineData.Substring(i);
I am reading data from an xml file.
The xml is set up so that there could be line feeds for some of the lines.
When I get these data back in the immediate window I see \n which I believe indicates the carriage return for each line?
How can I get rid of these?
"\n use master\n go\n IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[uspGetDomainName]') AND type in (N'P', N'PC'))\n BEGIN\n EXEC dbo.sp_executesql @statement =
I am trying to calculate the AVG for fields in a SQL SERVER database for a specified time interval. There may be times when there is no data for this interval. What would be the SELECT statement which will not execute the AVG of data if there is no data. I have tried to use "WHERE field IS NOT NULL", but this still throws an exception and stops execution of the program.
i am new to windows services and i have created a windows service which works fine when i manually start and stop it. i have changed the property to start the service automatically. and i need the service to start at the time of machine logging in. but the service is not starting. help me with fixing this issue. and this service is not related to any software. what it does is when the service is started is saves a string to the event viewer. but its not automatically started even if its property is set to start automatically.
The Service will start when the Operating System starts, not when a user logs in.
You could use a Scheduled Task to do that. Especially if the "Service" writes and then exits, that's not what services are for.
Services normally start when the system starts, and run continuously until the system shuts down.
thanks for your time for replying me. my problem is fixed. the problem was it was depending on a service which starts after this service starts. so i have fixed with this issue and once again thanks for your answer.
Im working on an image project which requires a lot of pointers. Ive recently had a smoothing function working where i loop over all the pixels and apply a smoothing function to the pixel. I've now been asked to seperate this function so mutliple functions can be used with the pixel loop.
The smoothing function worked in two parts, the first part set variables for use later in the function and the second part did the pixel loop and applied the smoothing to the image. Now i set the variables in one function, before i enter the loop, and then call a smooth function while in the loop. I tried to have a long* global to the class ,named _norm_buff, which is set in the first function and used in the second but after entering the smooth function the value at the address of the _norm_buff is reset to 0.
The line where the _norm_buff is reset
long* sum_buff = stackalloc long[this._width]; //Buffer to hold the vertical sums
Could the stackalloc be overwriting the value in _norm_buff?
I'm reading up on encryption in .NET, but I don't fully understand the concept of digital signing. Could somebody help me out here?
- Alice and Bob each have a set of private and public keys. Alice has Bobs public key and Bob has Alices.
- Alice wants to send a message to Bob and sign it
- She hashes the plaintext and encrypts it with her private key, and embeds the sign into the message encrypted with Bobs public key
- Bob receives the message and sign and checks it by decrypting using alices public key and comparing the hash values
Now heres what I don't understand:
Alice encrypts the hash with her private key and Bob decrypts it using Alices public key -- I though you could only encrypt using public and decrypt using private, not the other way around.
You send a private message by encrypting with the recipients public key. They decrypt with their own private key. This allows you to be sure only the intended recipient can view it, because only they have the correct private key.
You sign a message by encrypting it with your own private key. The recipient decrypts it with your public key. This verifies that it came from you, otherwise the decryption wouldn't have worked. But importantly the message isn't secret because anyone can decrypt with your public key as everyone has access to it. All you have done is verified the sender though.
This is a huge and complex topic. No one here is going to knock up code to do this for you. You have 3 choices:
1) Study and learn the specifications for WMV and MPEG video and actually understand how to do the conversion yourself.
2) Find a project/application online that does this, and is open source, and look at their source code. Note though, that you need to be aware of the license the open source project is released under if you plan on re-using their code.
3) Find a 3rd party .net component that will do the conversion for you. (Probably quite unlikely, but you might find 1)
WMV[^] is a proprietary container format, so to be honest you'll have difficultly finding much information on it, and will probably have to understand and reverse engineer the format yourself.
MPEG[^] refers to several things, and there are several different codecs all named under the same banner.