|
|
Ahh, you beat me to it!
|
|
|
|
|
So what I'm hearing (from the article) there is no good (and fast) solution other than possibly using the System.Net.IPAddress.HostToNetworkOrder/NetworkToHostOrder which appears will work for 4 bytes or less (shorts, int); but will it work for values that are stored in 8 bytes (doubles)?
Even with the host/network order if your class already has an byte [] defined you'll now you have to copy the return getbytes array into it!
This sure would have been so much easier if they supplied a flag parameter on the getbytes and other BitConverter routines. Along with a new method (same as getbytes) but returns a void and updates a destination array at a specified index for a value that you pass it: example: BitConverter.PutByte(destArray, destIndex, value, reverseEndianess);
I definetly use the network/host order To<type> to at least convert my bytes to a value. Still wondering if it will work for doubles?
Thanks.
|
|
|
|
|
I thought the host/network was a toggle for endianess. It's not. I didn't look at the source code but I suspect is basically doing the same thing that was mentioned in the article. And it will only work for 4 byte and 2 byte values.
Any other ideas? Otherwise I guess I will just un-generic my code and keep duplicating as needed.
(Sucks!)
|
|
|
|
|
Hi guys,i hope to learn how i can create a new textbox with checkbox or button.i want to create in same form.i want when i click button or checkbox ,form create a new textbox
|
|
|
|
|
In your button/checkbox event handler, create a new instance of a System.Windows.Forms.TextBox and add it to your form's controls collection using the Controls.Add method.
Paul Marfleet
|
|
|
|
|
thx a lot man...but what should i write in Controls.add("here") ???
|
|
|
|
|
try this :
private void button1_Click(object sender, EventArgs e)
{
System.Windows.Forms.TextBox textBox1 = new System.Windows.Forms.TextBox();
textBox1.Location = new System.Drawing.Point(81, 110);
textBox1.Name = "textBox1";
textBox1.Size = new System.Drawing.Size(100, 20);
textBox1.TabIndex = 1;
this.Controls.Add(textBox1);
}
Becoming Programmer...
|
|
|
|
|
Hi,
I have some Rich Text Control that i use as label ( im not using Static label because i need to change the color and font of some chars ) that i set to it in Run Time some String.
In case the string is too long ( the size of the Rich Text label is not auto size ( i mean that the size is const ) ) there will be some Tool Tip with the all string.
My question is ... how can i know if the string is too long ?
Is there is some way ?
Thanks for any help.
|
|
|
|
|
int stringlenght = rtb.Length;
Becoming Programmer...
|
|
|
|
|
This will bring back the string lengh of the all rich text ... and this is not what i need.
|
|
|
|
|
RTB.Text.Length would give the number of actual characters; that is good enough when
using a non-proportional font.
For proportional fonts, this may do it:
create a second but invisible RTB with AutoSize, give it the same text, read its Width,
compare with the Width you gave the original RTB and act accordingly.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
In code behind, borderstyle property is set. I want to do the same using javascript.
TextBox.BorderStyle = BorderStyle.NotSet;
Can you suggest something using
document.getElementById('<%=TextBox.ClientID%>'...?
Please help.
Thanks
|
|
|
|
|
You are in the wrong forum. This is the C# forum. Use the Web Development forum instead.
---
single minded; short sighted; long gone;
|
|
|
|
|
Not only are you in the wrong forum, but don't double-post...it doesn't help your chances of getting a useful response.
|
|
|
|
|
Sorry! Will post in the right forum.
Scott, it was not my mistake. I take great care while posting on CP. I have been here for some time.
Posted the message and refreshed it couple of times. Was sure that it didnt go through successfully and then posted again. Now, there are double ones!!!
Thanks
|
|
|
|
|
In code behind, borderstyle property is set. I want to do the same using javascript.
TextBox.BorderStyle = BorderStyle.NotSet;
Can you suggest something using
document.getElementById('<%=TextBox.ClientID%>'...?
Please help.
Thanks
|
|
|
|
|
This is a C# forum, you might want to ask in the Web Development forum.
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
hi
I cant seem to add 24 hours onto a datetime variable.
i have a startTime value and with that i want to add 24 hours to it to get a endTime.
what i have right now is:
DateTime startTime = DateTime.Parse(Request.QueryString["LogonDate"]);<br />
<br />
DateTime endTime = startTime;<br />
<br />
endTime.AddHours(24);
startTime's value is for eg. "2007/06/01 12:00:00AM"
but its not adding 24hours to endTime variable. It stays the same as the startTime.
Please somebody help me..
|
|
|
|
|
try this instead:
DateTime startTime = DateTime.Parse(Request.QueryString["LogonDate"]);
DateTime endTime = startTime.AddHours(24);
Without checking the docs I strongly suspect AddHours returns a new DateTime instead of modifying the existing one.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
dan neely wrote: Without checking the docs I strongly suspect AddHours returns a new DateTime instead of modifying the existing one
Correct - DateTime is immutable.
|
|
|
|
|
Hi,
the DateTime methods return a new DateTime, they do not change an existing one,
hence you need endTime=endTime.AddHours(24);
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
As others have said, the methods on DateTime do not modify the object you have. That is because the DateTime object is immutable. That means that once it is created it cannot be changed, you have to create a new one.
Had you done the simplest of research - like read the documentation - you would have found this out. (Hint: In pretty much all windows applications pressing F1 will bring up the documentation.)
|
|
|
|
|
Perhaps his F1 key is immutable and mapped to 'Switch Weapons' or 'Strafe'. (Do games still have strafe, like the original Doom?)
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Malcolm Smart wrote: Perhaps his F1 key is immutable and mapped to 'Switch Weapons' or 'Strafe'. (Do games still have strafe, like the original Doom?)
I doubt he's up to any game beyond Snap.
Deja View - the feeling that you've seen this post before.
|
|
|
|