|
In the debugger, check to be sure the actual values are what you expect.
But, personally, I wouldn't use the ArrayList, I'd make separate fields in the ProgressChangedEventArgs.
|
|
|
|
|
Three remarks FYI:
1.
there is ProgressChangedEventArgs.ProgressPercentage which is of type int; its name suggests the value should be in the range [0,100] however the value is irrelevant to .NET and you can pass any value you choose, from int.MinValue to int.MaxValue, so you have a full 32-bit resolution at your disposal.
2.
I don't expect people be interested in a very accurate progress value; if you were to display a progress bar on a display with say 1280 pixels, then you would be able to show no more than 1281 different values anyway; yes you could just show a number, but that does seem a bit awkward.
3.
Once you have settled on the exact range and resolution you want to pass around, you should make sure not to call ReportProgress() with the same progress value over and over, as each call causes a thread switch, and achieves nothing as no new information is passed anyway. So create a little method and compare with the previous value, as in:
public void MyReportProgress(int val) {
if (val!=previousVal) {
previousVal=val;
ReportProgress(val);
}
}
You may be surprised how much faster your actual operation runs once you stop passing unnecessary progress resolution back and forth (and stop repainting that progress bar abundantly).
|
|
|
|
|
Hi
I'm working on an client/server application which uses the UdpClient class to communicate over a network. The server end waits for a datagram to be received, after which it then processes the datagram and sends back a response. To stop the code from blocking, I am using Udpclient.BeginReceive and doing it all asynchronously. The BeginReceive method takes a delegate as its argument, which points to the method which processes the data (the callback method). What I need to know is whether the callback method runs in a separate thread? As usual the documentation is useless.
Thanks
modified on Sunday, August 15, 2010 11:35 AM
|
|
|
|
|
The callback method runs in a separate thread obtained from the thread pool.
|
|
|
|
|
|
Don't know about the OP but I found it useful.
I bug
|
|
|
|
|
Thanks.
|
|
|
|
|
How much memory can be consumed for a process that is running in
a) 32 bit environment
b) 64 bit environment
Is it 2G( less than ) per process? If so, is there any reason for such a limitation?
Suppose process is running with 2GB RAM. And if I am upgrading the RAM to 4GB, will there be any change in max memory?
|
|
|
|
|
Under 32 bit versions of Windows, most of the time processes are limited to 2GB of memory. You can specify the /3GB[^] switch in the BOOT.INI file for Windows XP and Server 2003 to increase that limit to 3GB.
For a comparison of 32 and 64 bits, try reading here[^].
|
|
|
|
|
There may be two parts to your question:
1. the amount of logical memory (the virtual memory address space) you can get, that is 2GB (sometimes 3GB) on Win32 (i.e. 50 to 75% of the theoretical 2^32). and a lot more on Win64 (not sure, could be up to 4000 times as much). That is individual to each process.
2. the amount of physical memory (how much real memory your app is allowed to use) your process is actually getting; this depends on other processes are running and doing. The sum over all processes cannot exceeed the amount of physical memory; all virtual excess will be swapped to disk (and may cause significant delays).
So if you have two or more processes aiming for lots of memory, and your system is Win32 with 3GB of RAM, each process is likely to get no more than 1GB of physical memory. By minimizing one's main form, the other may get some more.
ADDED
Here[^] are some more facts for different Windows editions.
/ADDED
|
|
|
|
|
I am making a desktop application that is supposed to read data sent via Http and i have no idea how to begin it. I have made a distributed application that read data from TCP by using TcpClient classes but this is a different thing all together. Where do i even begin?
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
|
Have a look at the WebRequest[^] class or you could use WCF
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I am developing a control that displays a grid of pictures. I want to be able to select a picture by clicking on it, and change its appearance (eg. with a border) to show that it is selected. I have created:
1. a class derived from UserControl that contains a PictureBox for the picture
2. a class derived from FlowLayoutPanel to contain the pictures. This overrides CreateControlsInstance() to return an instance of...
3. a class derived from Control.ControlCollection to contain the picture objects. This overrides the Add(Control value) method in order to add a handler to the Click event of the control being added to the collection. It also contains the click event handler, and this is where my problem lies:-
It seems to me that the logical next step is for the click event handler to identify the control that has been clicked (no problem) and to call its Select() method, which will then alter the appearance of the control as required. The problem is that Control.Select() cannot be overridden. This raises two questions:
Q1: what does Control.Select() actually do?
Q2: how do I implement the change in appearance of the control. Obviously I could just set the UserControl.BorderStyle property from within the click handler in collection class, but surely an object should make its own decision as to how it looks when it is selected.
I can only assume that I've misunderstood something, or am doing it all the wrong way. Can anyone advise?
Dave
|
|
|
|
|
Hi,
Is there a way to build a join query that combains 3 tables?
how i translate this into linq-
SELECT a.au_lname, a.au_fname, t.title
FROM authors a INNER JOIN titleauthor ta
ON a.au_id = ta.au_id JOIN titles t
ON ta.title_id = t.title_id
WHERE t.type = 'trad_cook'
ORDER BY t.title ASC
Can someone please help me?
|
|
|
|
|
I'm not an expert in linq to sql but
it works with objects/lists. Try:
var query = from a in context.Authors
join ta in context.TitleAutors on a.au_id == ta.au_id
join t in context.Titles on ta.title_id == t.title_id
orderby t.Title
select new { LastName = a.au_lname, FirstName = a.au_fname, Titel = t.title;}
I bug
|
|
|
|
|
nope, dosen't work
== replaced by equals
|
|
|
|
|
what's the error message you get?
I bug
|
|
|
|
|
i doesn's get any error,
but query dosen't return the write result.
|
|
|
|
|
hi guys
i wanna a pattern to find number of html control in page
i test this pattern but thers no result:
@"^<\s*["+pattern+@"]{1}\s(\s*\w*\s*\W*\s*\d*\s*)*/>$"
that pattern is a variable that contain like img,input and so on
modified on Sunday, August 15, 2010 4:34 AM
|
|
|
|
|
we happen to have a Regular Expressions forum since a couple of weeks, maybe you better ask there.
|
|
|
|
|
Yeah, what Luc said, also this[^].
|
|
|
|
|
Hello,
Is there some class / library on .net framework that i can use to activate the webCam directly ?
I want to activate the webCam and have the ability to take snapshot in real time.
Thanks for the help.
|
|
|
|
|
|
Hi, all,
I have a class("Parent") that keeps a dictionary of items of another class("Child"), which I am trying to make generic.
I don't want to make Parent generic, but it needs to know the type to pass to the dictionary constructor:
Dictionary _d = New Dictionary(Of String, Child(of ____))
I could just use Object, but that would defeat the purpose.
I was hoping something like:
Type _childType = (typeof constructorParam)
and then...
Dictionary _d = New Dictionary(Of String, Child(of _childType))
...would work. Instead, the compiler says 'Type _childType' is not defined.
I am hoping there is an easy way to do this Thanks!
|
|
|
|