|
I appreciate the thought.
I already saw a couple of those, but I was hoping to avoid adding custom controls into my code.
Especially since it should be such a small change, dangit! Why does MS torment me so?
My other signature is a Porche.
|
|
|
|
|
Use keydown etc. events to filter out any bad characters, then in lost focus use IpAddress.TryParse(string). If that works IpAddress.Parse(string).
I don't know about your app, but you might also want to handle host names in the same box, which makes things a bit more complicated as well.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
As I said, I don't know how to do that without creating a custom control (i.e., inheriting the class). Doing that seems like over-working what should be a simple event handler.
As a one-off, that may be a necessary compromise. But it seems a bit like hard coding the text value for a button. Do it enough, and you lock yourself down.
If I do go the custom control route, should I override Paste functionality for four small textboxes, or should I override masking functionality for one big textbox?
Either way I really don't know the best functionality to override, so I'll have to pull my hair out all over again on that.
All I want is a super slick-input UI for IP addresses. Is that so much to ask for, Microsoft?
My other signature is a Porche.
|
|
|
|
|
Hi,
What is the fastest way to transfer a file from one system to another?
eg:
i have a server in listening mode, i send the image through socket to the server and from there to the destination system
or
upload to the ftp and download from there
Which is more effective and is there any other fast and better way?
Thankyou
YPKI
|
|
|
|
|
This is a dumb question. Obviously, the limitation is the network speed between machines. That, and, you're asking if it's faster to send a file directly, or send it twice.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
|
Did he not just say??
|
|
|
|
|
But that's okay, because you misunderstood his poorly worded question.
He appears to have 3 machines involved. The server is the midpoint, without which he cannot communicate to the end user PC.
He wants to know if using sockets is somehow faster/slower than FTP.
My other signature is a Porche.
|
|
|
|
|
Exactly
|
|
|
|
|
Hi,
What is the size limit of a byte[]?
Thankyou
YPKI
|
|
|
|
|
Any more stupid questions ? Google broken where you live ? You can't write code to work this out ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
i need to send a file more than 1 gb using byte[]...can i?????
|
|
|
|
|
You can't store a file in a byte array. Do you mean the contents of a file?
How and where do you need to send it as you think that you should have all the data in a single array?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Why would you need to ? Do you have a gig of RAM you're willing to devote to this process, on top of the RAM in your computer ? Have you considered a more efficient design ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
The maximum size that a byte array accepts without givin an overflow error is the maximum int32 value, so 2147483647 bytes, exactly 1 byte less than 2GB.
Keep in mind, though, that storing 1GB or more data in memory could not be very efficient, I suggest you to use streams for copying files.
|
|
|
|
|
I am working on a color tracking app. How do I get the color of the pixel at the mouse's position in a bitmap image. I am using C# with the AForge.NET image processing library. If someone can write an example or even a small program that does what was just said so that i may learn from the code, I would be greatly appretiative. I am very new at codeing and I learn best by example. Thanks again.
|
|
|
|
|
sebogawa wrote: I am very new at codeing and I learn best by example. Thanks again.
In other words, you have no idea how to program and you want the code ? Why are you using image processing libraries if you don't even know how to use C# ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi
I am trying to import from an excel sheet in 2007, any other format of excel works fine so im assuming it is the connection string that is at fault.
My current connection string is
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ExcelFilePath + ";Extended Properties= Excel 8.0;HDR=Yes;IMEX=1";
I have read on connectionstrings.com that extended properties needs to be changed to 12.0 and i should use ACE.OLEDB provider, i have tried this but get an error saying ISAM is not installed.
Any assistance will be appreciated
Thank you..
Nothing lasts but nothing is lost
|
|
|
|
|
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFileName + ";Extended Properties='Excel 12.0;HDR=NO'";
And then before use this OLEDB, you compute should install Office 2007.
|
|
|
|
|
The Microsoft.ACE.OLEDB.12.0 is supported by the Access 2007, and the windows xp does not support this high version ACE.OLEDB
|
|
|
|
|
thanx..
so this would not work for excel then?
is there a reason i should make hdr = no?
Nothing lasts but nothing is lost
|
|
|
|
|
Hi again
i solved it, the connection string was fine, i had to add the excel 12.0 object library..
my bad, weak mistake on my behalf
thanx again
Nothing lasts but nothing is lost
|
|
|
|
|
Hi
I have sample MDI application with two these forms :
Form1(Main Form) is MdiParent
Form2 is MdiChild
i want when Form2 open, it should be Maximize and user can't change it's WindowState, for this, i wrote this code to open Form2 :
Form2 frm;
frm.MdiParent = this;
frm.Show();
Form2 Designer Code :
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 268);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form2";
this.Text = "Form2";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);
But, in runTime (as u see in above designer code which Maximize and Minimize set to False), when i open Form2, the Maximize and Minimize appear in Form2 and when click on Maximize button, it's WindowState change to normal (which i don't want this).
Where does my problem and how to solve it ?
Thanks
|
|
|
|
|
I didn' realize at the time but I have an MDI app and when I set minimize and maximize to false
MY APP DID THE SAME THING!
I did a bit of looking around and came up with this
Put the code below in the forms resize event and this will prevent the form minimizing
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Maximized;
}
If the form reverts to "normal mode"
add this as well TO THE SAME resize event handler this will prevent the form going to normal mode
if (this.WindowState == FormWindowState.Normal)
{
this.WindowState = FormWindowState.Maximized;
}
The top code block detects "minimized state", if so then maximise.
The bottom code block detects "normal state", if so then maximise.
I DONT SEE WHY THIS SHOULD NOT WORK BUT I HAVE NOT TRIED THIS SO I CANT VOUCH FOR IT
|
|
|
|
|
First of all, I know the standard answer to this question is "If you need to know, you're doing it wrong", but I really do need to know!
Long story short, I have a caching mechanism in a web service (IIS 6) that can cache thousands of items in memory and return them almost instantly, without requiring a trip to the main datastore.
However, when the cached items expire they need to be refetched from the datastore, but only one caller can be executing the 'fetch' code at a time (or else it runs into all sorts of horrible race conditions and deadlocks). All the other callers must either wait for the first thread to update the cache (if the item is not found in the cache) or simply return the cached item while it is being updated in the background.
Each data item contains its own ManualResetEvent, which it uses to block while the cached item is updated. By giving each dataitem its own ManualResetEvent, I can allow other data items to be fetched without blocking them - the only calls that are blocked are those for the *exact* item that has expired.
My concern is that I will run out of handles for the data items, since each item has its own ManualResetEvent, and there could potentially be tens of thousands of data items. Do I need to worry about this, or should I try to come up with an alternate implementation?
Perhaps I could use a pool of ManualResetEvents that can be assigned to items as needed, similar to the way database connection pooling works? This is probably a "better" implementation, but it is more complex and harder to debug...
Thanks for your help
modified on Tuesday, April 14, 2009 4:14 PM
|
|
|
|