|
V. wrote: We have to save a datetime in the database in format: "yyyyMMddHHmmssff".
Why? Can't you store it as a datetime value?
---
b { font-weight: normal; }
|
|
|
|
|
Sure we can, but client specs says otherwise .
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
Hi folks,
I need to convert characters such as: 0xFF, 0xAE, 0x24 into integer or byte.
I tried to strip the 0x and let Convert.Tobyte does the conversion but it didn't work.
Please help.
Thanks
Tony
|
|
|
|
|
There's no standard code for this that performs very well. I wrote this to fix the problem. It uses the ascii table to conver the char value (cast it to an int) of a character. Be sure to pass valid characters to the method, it has no error handling. It's case insensitive, by the way. Hope it helps.
int first = HexToDec((int)yourfirstchar);
int seccond = HexToDec((int)yourseccondchar);
int total = 2 * (byte)(first * 16 + seccond);
private static int CharToHex(int charValue)
{
if (charValue > 64 && charValue < 91)
return charValue - 55;
else
if (charValue > 96)
return charValue - 87;
else
return charValue - 48;
}
|
|
|
|
|
You must remove the "0x" and see this sample:
int i = int.Parse("FF", System.Globalization.NumberStyles.HexNumber);
float f = float.Parse("FF", System.Globalization.NumberStyles.HexNumber);
byte b = byte.Parse("FF", System.Globalization.NumberStyles.HexNumber);
|
|
|
|
|
Thank you buddy.
All work except the float.
But it doesn't matter because all I need either the integer or byte.
Thanks again,
tony
|
|
|
|
|
This is my code for changing input from textbox to float value:
Just play with this code.
byte[] tempbyte = new byte[4];
tempbyte[0] = byte.Parse(this.textBox8.Text.Substring(6, 2), NumberStyles.HexNumber);
tempbyte[1] = byte.Parse(this.textBox8.Text.Substring(4, 2), NumberStyles.HexNumber);
tempbyte[2] = byte.Parse(this.textBox8.Text.Substring(2, 2), NumberStyles.HexNumber);
tempbyte[3] = byte.Parse(this.textBox8.Text.Substring(0, 2), NumberStyles.HexNumber);
this.textBox7.Text = BitConverter.ToSingle(tempbyte, 0).ToString("F2");
|
|
|
|
|
Hi guys
I'm writing an application that uses threads to execute some code. But these thread must run until some event happens. When this thread has finished executing and the event to stop it has not occured, the thread must start executing again. Now, how do i make this thread start executing again without starting a new thread?
Thanks
Kulile --- RSA
|
|
|
|
|
Run the thread method in a loop, so that it starts again and again until the event switches a stop/running flag:
private void yourThreadMethod()
{
this.isRunning = true;
while(this.isRunning)
{
doSomething();
}
}
private void sender_eventMethod(object sender, EventArgs aarrrgs)
{
this.isRunning = false;
}
_____________________________________________________________________________
I don't expect too much, all I want is your vote for Halbsichtigkeit.
|
|
|
|
|
if you use pirated software you have to write :
private void sender_eventMethod(object sender, EventArgs YYAAARRRGGS)
:P
|
|
|
|
|
IMO it would be better to use a synchronization object, such as mutex or ManualResetEvent
|
|
|
|
|
Yes, that would be the professional way. But mostly a simple variable does it fine.
_____________________________________________________________________________
I don't expect too much, all I want is your vote for Halbsichtigkeit.
|
|
|
|
|
Your statement is contradictory. Professionalism means doing it the right way.
|
|
|
|
|
Can you explain why those approaches would be better than the bool flag in this specific case?
what can go wrong in this case when using a bool flag?
(can it blow up if the bool is both read and written to at the same time?)
//Roger
|
|
|
|
|
Hi, I have been given a dll (built using either C or C++, but not COM) and am trying to create a wrapper class to call its functions (using importdll). I have the header file (.h) so I know the function names and parameters. The trouble is, I don't know how to map them to C#. So, is there a reference website that shows what types I should use in C#? There are pointers to GDI+ bitmaps, pointers to stucts and dereferencing as well as simple types like ints. Any suggestions for a reference website or even a tool to generate the code for me?
Thanks in advance
Andy
|
|
|
|
|
Read about DllImportAttribute here[^].
|
|
|
|
|
hello
i think something changed in framework 2.0. i can't load a icon in my project. can uou send me a sample?
thanks,
mihai
|
|
|
|
|
Why don't you post the code, and someone might be able to tell you what's wrong.
---
b { font-weight: normal; }
|
|
|
|
|
i solve the problem. not the code was the problem. i don't load corectly icons in resource.
thanks,
mihai
|
|
|
|
|
hello
i need some documentation and sample how to use remoting. i don't find noting interesting on web.
thanks,
mihai
|
|
|
|
|
The best text in the world on remoting: Advanced .NET Remoting by Ingo Rammer
His website also provides alot of information, the first 8 sites that came up in Google provided lots of information, and I believe there is an article here on code project that gives a client/server chat example using remoting. I suggest you improve your search skills.
|
|
|
|
|
Does someone have some references on the commands ADPU for access to the smartcards?
I am trying to read the data from a smartcard using the winscard.ddl API . I succeed in connecting to the card but I don't find information on what commands to send
thanks
|
|
|
|
|
Good luck.
SmartCard commands are typically specific to the particular card involved, and depending upon what the card is and what it is used for, you will likely never be able to get that information. The ISO specification (It has been too long... I don't even remember which one it was.) only defined a very few "generic" commands, and as I recall, they were just suggestions anyway.
I used to work for a company that developed its own SmartCard reader, and just to get sample cards and the command documentation to test with the reader, we had to jump through all kinds of legal hoops with the SmartCard vendors, involving all kinds of Non-Disclosure agreements, etc.
Don't hold your breath...
Tom
|
|
|
|
|
hi all, can someone help me how to link up multiple forms in VS 2003? i mean when i debugged, i clicked a "link" in form 1 how to get to form 2??
i appreciate experts out there can teach me the coding.. thanks in advance
|
|
|
|
|
Use the event LinkClicked from LinkLabel and use this code:
Form form = new Form();
form.ShowDialog();
or
form.Show();
|
|
|
|