|
byte[] ab = new byte[3];
ab[0] = a;
ab[1] = b;
ab[2] = c;
ab[3] = (byte)(a ^ b ^ c);
Warning: "index out of bounds" is imminent
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I know that but thank you for the anouncement;) im very happy that you guys helped me out!
|
|
|
|
|
Following on to musefan's point, you have a subtle error in your declaration of the byte array. In this line:
byte[] ab = new byte[3]
You declare ab as a byte array which can only hold three elements. However, in the lines below it, you fill it with four elements; as has been said, this will cause an IndexOutOfRangeException (or something like that) when you assign a value to ab[3]. To fix this problem, change the declaration of ab to
byte[] ab = new byte[4]
This will allow ab to hold four elements, fixing the error
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Hi,
this is what I would write:
List<byte> list=new List<byte>();
list.Add(a);
list.Add(b);
list.Add(c);
writeWithXor(port, list);
...
public void writeWithXor(SerialPort port, List<byte>list) {
int xor=0;
foreach(byte b in list) xor^=b;
list.Add((byte)xor);
port.Write(list.ToArray());
list.Clear();
}
This way you don't have the hassle of counting bytes and allocating the right array; and you can reuse
writeWithXor() for any amount of data that needs to be followed by a 'checksum'; and of course I would keep the serial port open, probably as long as my app is running.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I want 2 create a component like msn status lable.
that look like a label & a textbox & a dropDownList.
it can drop down show the menu,and it can be edited when I click the label.
how to do that?
|
|
|
|
|
You make a user control with a Label, TextBox and ComboBox
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Most probably you will make a user control.
|
|
|
|
|
|
this question is a mixture of sql and c# windows services...
i have a windows service which connects to COM1 port(serial port) and writes the data into a sql db. i have an installer which installs the service and run it immidiatly after setup is completed , but stops very soon because of this error which appears in event log :
provide : named pipes provider . error 40 - could not connect to sql server
i have installed sql server 2005 (not express ed) and the connection string
in my service is :
string _connectionstring =
"server=" + Environment.MachineName +";Initial Catalog=myDatabase;"+
"user id=myLogin;password=myPassword;trusted_connection = true;";
i have tested this connection string in a simple windows form and it works!
please notice that this sql server and windows service are working on local computer , not a network.
|
|
|
|
|
check that Environment.MachineName is returning the correct value you need, i.e. the SQL Server location. The other information in your connection string should be irrelevant at this time, as with the error you have the issue is usually because is pointing to wrong place
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I think you may have a conflict in your connection string. You are providing a user name and password but also specifying trusted_connection=true. My assumption is that the service is trying to logon to the SQL server as the user the service is running under. Try changing trusted_connection = true to trusted_connection = false.
|
|
|
|
|
Would that not be an authentication error instead thou?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Quite possibly but I couldn't count the number of error messages I've seen that don't really relate to what the problem is.
|
|
|
|
|
very true
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
hi..
Can anyone have idea about "datafile" in ACOS3-24 smart card,
i have to write and data in it using C# SDK.
i analysed that each datafile can contain upto 255 data records,but i m confused that how much "datafile" can we make. and what is max capacity (no of bytes)each "datafile" can contain.
Plz reply anyone who have some idea,
plz provide any help regarding this whatever anyone know about this.
Thanx.
|
|
|
|
|
I'm afraid, unless you are VERY lucky, that the knowledge you want is not available here. You would be better off going to the manufacturers of the device or SDK.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
|
Hi.
Could you please guide me, how we can convert an IntPtr object to an Image object ?
thanks.
|
|
|
|
|
|
Hello,
How to check and patch your old installed program using c#?
Ex: I had installed program but after couple of months i do changes how can i check the version of the old software inruntime and how can i create patches of it?
thanks
|
|
|
|
|
ClickOnce or your install program are the best way to do this. Otherwise, you need a patcher program that runs and overwrites your exe.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
sorry, Sir what is clickonce?
|
|
|
|
|
The best way is publichingg your application with clickonce.
After completing development your application right click on your Windows application and select publish.
After that all you have to do is put published files to a location such as web site, ftp or file share that users may access.
To install users may open publish.htm and click install or double click the .application file at the root.
|
|
|
|
|
what does it mean by clickonce? Is this a software?
|
|
|
|
|