|
No worries. Think of the numbers as being like number of stars
Not sure if you already saw this, http://bytes.com/forum/thread448993.html[^], even though it is in VB6, it shouldn't be hard to implement in C#
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Zocrates wrote: however it also gives it focus. As stated I dont want the form to have focus.
No, that's what I meant in my post. At least it works as you describe on my system (XP Pro, VS2005)
I tried with both Mozilla and Notepad in full screen and my form came to top but focus remained with the previous window (Mozilla or Notepad)
led mike
|
|
|
|
|
Hrm. You have a main form that creates another thread to populate a second form? And the form is always on top of each screen yet doesnt have focus? This doesnt seem to be the case when I try this.
|
|
|
|
|
I tested this with a C# Winforms and an MFC application.
1) Main dialog launches and sets a timer to like 10 seconds
2) I manually bring another application like Mozilla or Notepad to the top and give it focus
3) Main dialog timer event fires where my code creates a second form or dialog. During 2nd window initialization topmost is set
4) 2nd window appears on top of Mozilla or Notepad but Mozilla or Notepad maintain focus.
led mike
|
|
|
|
|
I made a test app like you mentioned above and I get the desired action. However when I add in the code to make this form being called by a new thread it no longer has the desired result.
I am using ThreadPool.QueueUserWorkItem(new WaitCallback(DisplayPopup), test) to create a new thread so the program can continue executing while the popup sits on the screen.
|
|
|
|
|
Zocrates wrote: However when I add in the code to make this form being called by a new thread
I don't know what that means "make this form being called by a new thread"?
Your forms must be manipulated from a GUI thread not a worker thread. You use Invoke to do that.[^]
led mike
|
|
|
|
|
The popup is a new form. The main thread processes the main form. The second form (popup) is managed by a different thread.
|
|
|
|
|
I was able to find a solution.
I was able to remove the dependency on the ThreadPool by using the modeless Show() instead of modal ShowDialog(). This allowed my program to continue to process while the popup was still showing. This handled the none maximized screens.
For the maximized screens I overrode the 'ShowWithoutActivation' property of the popup form.
All this of course with TopMost set to true.
|
|
|
|
|
Hrm. Actually it doesnt seem to work everytime. It works in both full screen mode and normal mode. Then it will stop working. Then I resize a screen or something and it works again....
|
|
|
|
|
It appears to be working on both full screen and normal screen until I close one of the popups(forms). Then the very next one will take focus away. After that it will begin working properly until I close one of the popups.
|
|
|
|
|
Hey guys
I have an MDI form that has a panel across the top for displaying business information. Whenever any of this panel is updated..I get this nasty bleeding effect where i can see through the borders of the labels etc. Has anyone ever seen anything like this?
|
|
|
|
|
Not seen this but have you tried calling its Invalidate() method to force a redraw?
If it's the panel's child controls that are the problem call Invalidate(true)
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hi Guys,
i'm trying to sort the result from a datatable based on month and year.
getMonth below arranges d group header how i want. But the code puts on item per group. The prob, groups are repeating. Ex: May, 2008 repeats like five times but with diff items under it.
private string getMonth(string theDate)<br />
{<br />
string theMonth = theDate.Substring(0, theDate.IndexOf("/"));<br />
string theYear = theDate.Substring(theDate.LastIndexOf("/") + 1, 4);<br />
<br />
return (MonthName)int.Parse(theMonth) + ", " + theYear;<br />
}
Then i try to add the items, first into an array, then a ListViewItem
<br />
for (i = 0; i < dtAcct.Rows.Count; i++)<br />
{<br />
DataRow drow = dtAcct.Rows[i];<br />
<br />
ListViewGroup lvg = new ListViewGroup(getMonth(drow[0].ToString()));<br />
lvAccount.Groups.Add(lvg);<br />
<br />
string[] items = { Warehouse.DateMender(DateTime.Parse(drow[0].ToString())),<br />
drow[1].ToString(),
drow[2].ToString(),
setTransDetails(Int32.Parse(drow[3].ToString()), drow[4].ToString()) };<br />
<br />
ListViewItem lvi = new ListViewItem(items, lvg);<br />
lvAccount.Items.Add(lvi);<br />
}<br />
pls, can anyone help resolve this for me. Thanx a million!
He who goes for revenge must first dig two graves.
|
|
|
|
|
listen, do you filter/sort sql data on c#?
my advice is DON´T DO IT.
Create both read and write store procedures in sql and trigger them with c# events (like form_load or button_click or whatever).
It´s easier!!!
|
|
|
|
|
I'm trying to figure out the correct way of compiling the final version of a console application for other people to use.
I've done the "Build project" way, but then the user has to copy over all of the DLL files in my "bin" directory in order to get it to work. This way isn't very professional.
I've also done the "publish project" option, however when I publish it, I get 2 "application manifest" files (1 names "MyProject_1_0_0_0" and another simply names "MyProject"), a directory containing the DLL's (usually called "MyProject_1_0_0_0"), and a setup.exe file. I'm unsure of which ones to send over, so I just send them all over. This way isn't very professional either.
So, what's the correct way to compile my final version of a console application before handing it off to a user?
Thanks.
-Goalie35
|
|
|
|
|
Goalie35 wrote: So, what's the correct way to compile my final version of a console application before handing it off to a user?
You dont have to publish anything (I think thats to do with click once). The content in the bin\Release directory should be sufficient
|
|
|
|
|
Visual Studio .NET allows you to specify files to be included in a deployment project (whatever your application might be). See details[^].
SkyWalker
|
|
|
|
|
I have to create a multithread program. It must control a pool of thread. How do I do this in C#?
The idea is: Reading a properties file, the program will know what kind of thead It will start. Each thread will take care about one subject. Each thread will receive a parameter indicating how many thread will have in its pool.
The MainThread will control the pool of thread, when it needs to process some UDP message will request a free thread in the pool. Will pass all of the information (data) to the thread and order to run. When the thread finishs its job will be in suspend mode waiting for next job.
I had develop this kind of program in Delphi and in Java with success! But in C# I did not find any way to do this.
Thanks.
+------+ +----------+
| | |Thread-UDP|-------> +------+
| .EXE |-----> |LISTENER | | T2 |
| | +----+-----+ +------+
+------+ | \
| \
\/ \
+-------+ +--------+
| T1 | | T3 +
+-------+ +--------+
|
|
|
|
|
There are a lot of tutorials on the topic.
You could start very well here[^].
SkyWalker
|
|
|
|
|
This [^] might help.
Google it up, there's a million more!
He who goes for revenge must first dig two graves.
|
|
|
|
|
This [^] might help.
Or, this[^]
Google it up, there's a million more!
He who goes for revenge must first dig two graves.
|
|
|
|
|
A while back I wrote a class named SynchronisedQueue[^] for parallel processing of Mandelbrot graphics.
The main thread could use it to send the jobs to the threads by simply adding it to the queue. The threads would periodically try to get something from the queue while they are idle.
The class for a thread could be something like:
public class WorkerThread {
public volatile bool Contine;
private SynchronisedQueue<Job> _jobs;
public WorkerThread(SynchronisedQueue<Job> jobs) {
Contine = true;
_jobs = jobs;
}
public void Run() {
while (Continue) {
Job job;
if (jobs.TryDequeue(out job)) {
} else {
Thread.Sleep(100);
}
}
}
}
The main thread creates a queue, then creates the objects for the worker threads and sends the queue along to the constructor.
If you need to send a result back from the worker thread to the main thread, you add another queue for the results. When the thread is done it just adds a result to the queue, and you have a timer in the main thread to look for results in the queue.
The code for dispatching the jobs gets really simple. There is no requesting of threads and handling the situation of waiting for a free thread, just throw the jobs in the queue, and the first thread that gets free grabs it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
hi
i am using gridview control and in gridview control i have checkbox. when i click on linkbutton checkall then i want that check all checkbox and if i click on uncheckall then i wnat that uncheck all checkbox. how can i do using javascript? plz help?
thanks in advance.
|
|
|
|
|
Try the web forum.
But here is half the answer. You figure out what 'r' is
function SelectAll(sender)
{
var checked = sender.checked;
var ll = document.getElementsByName("r");
for (var i = 0; i < ll.length; i++)
{
ll[i].checked = checked;
}
}
|
|
|
|