|
Hi
i have a main form which set it's IsMdiContainer to True (MDI Form), and second form which set MaximizeBox,MinimizeBox to False and wrote this code to display it in MDI form :
this.frm = new Form2();
frm.MdiParent = this;
this.frm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.frm.MaximizeBox = false;
this.frm.MinimizeBox = false;
frm.Show();
but when i run application, the MaximizeBox and MinimizeBox already exists (even when i click on MaximizeBox, it back to normal mode!) which i don't want to user interact with it. where does my problem and how to solve it ?
Thanks
|
|
|
|
|
Dear go to properties and turn off the maximize button
regards
sajid salim khan
|
|
|
|
|
Hi
as u can see above code, the maximize button and minimize button has been turned off.
can anybody help me ?
|
|
|
|
|
Following explanation is from msdn document
The Monitor class does not maintain state indicating that the Pulse method has been called. Thus, if you call Pulse when no threads are waiting, the next thread that calls Wait blocks as if Pulse had never been called.
If not threads is wating then pluse is ignored??
I have following code ...it starts 3 threads and enques 12 tasks before even 3 threads finished work that means for next 9 pulses there are not threads waiting. Still all the tasks get processed. According to documentatiion next 9 pulses should be ignored as if they never happened. Did I misunderstood the documentation.
using System;
using System.Threading;
using System.Collections.Generic;
namespace ThreadingConsole
{
public class TaskQueue : IDisposable
{
object locker = new object();
Thread[] workers;
public Queue<string> taskQ = new Queue<string>();
public TaskQueue(int workerCount)
{
workers = new Thread[workerCount];
// Create and start a separate thread for each worker
for (int i = 0; i < workerCount; i++)
(workers[i] = new Thread(Consume)).Start();
}
public void Dispose()
{
// Enqueue one null task per worker to make each exit.
foreach (Thread worker in workers) EnqueueTask(null);
}
public void EnqueueTask(string task)
{
lock (locker)
{
taskQ.Enqueue(task); // We must pulse because we're
Console.WriteLine("START : " + task + " " + DateTime.Now.ToString()); // Perform task.
Monitor.Pulse(locker); // changing a blocking condition.
}
}
void Consume()
{
while (true) // Keep consuming until
{ // told otherwise
string task;
lock (locker)
{
while (taskQ.Count == 0) Monitor.Wait(locker);
task = taskQ.Dequeue();
}
if (task == null) return; // This signals our exit
Thread.Sleep(10000); // Simulate time-consuming task
Console.WriteLine("END : " + task + " " +DateTime.Now.ToString()); // Perform task.
}
}
public void Start()
{
string[] sTasks = GetNewWork();
Console.WriteLine("Start Enquing Tasks : " + DateTime.Now.ToString());
foreach (string s in sTasks)
this.EnqueueTask(s);
Console.WriteLine("Finished Enquing Tasks : " + DateTime.Now.ToString());
}
string[] GetNewWork()
{
return new string[] { "AAAAA", "BBBBB", "CCCCC", "DDDD", "AAAAA1", "BBBBB1", "CCCCC1", "DDDD1", "AAAAA2", "BBBBB2", "CCCCC2", "DDDD2", "AAAAA3", "BBBBB3", "CCCCC3", "DDDD3" };
}
}
}
class Program
{
static void Main(string[] args)
{
using (TaskQueue queue = new TaskQueue(3))
{
queue.Start();
Console.ReadLine();
}
}
}
kyus
|
|
|
|
|
|
Thanks for response. You have written excellent article.But in example u are using wait on _key both while en queuing and dequeuing and are calling PulaseAll. So if no worker thread is available task won't be enqueued. In my example I am not using wait while enqueuing tasks so it will add all tasks and call pulse regardless whether there is any worker thread waiting and still all tasks get processed. I still am confused about it.
|
|
|
|
|
ykcontact wrote: You have written excellent article.
Thanks. Please vote on the article if you found it useful
There is another mt tutorial here: http://www.albahari.com/threading[^]
If you are still confused, I suggest you start another question here and include your code so far.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Hello there,
Thanx for taking interest in my question. My query is about designing a Windows Form, interactively. I have set the FormBorderStyle property to None, thus removing the Title Bar from the form. Now I only have the form interface without those title bars. However, that is not making the form attractive. I want to make the form graphically attractive. I also want to apply shades to the texts (labels) in the form. How can I do that?
Your help will be appreciated,
Rajdeep.NET
|
|
|
|
|
Hello.
Im having a picture on my computer etc named "Hello.jpg", and I want to send it to a homepage etc http://mysite.com/image.php which then saves it to a blob columm in a database.
I tried to do a simple GET with the byte array that contains the picture, but of course it doesn't save the whole image just with http://mysite.com/image.php?image=bytearray
How can I solve this problem?
Thx
|
|
|
|
|
Not enough information. If GET-ing like that the data should obviously be URL-encoded, but what does the PHP script expect? Perhaps a POST instead of a GET? Maybe with base64 encoded data? We don't know - do you.
|
|
|
|
|
Haven't really created the PHP script yet.
I'm not having any specific idea how to do it. I'm looking for an idea and some help how to fix it. But yes, a post to the site will be as useful as a GET.
I'm looking and searching for ideas. Google didn't help me very much this time
|
|
|
|
|
Ok so you don't know either, because no one knows, so well.. PHP should make this pretty easy, but I'm not really into PHP - I hope someone else here will say something sensible about it
|
|
|
|
|
Member 4417892 wrote: How can I solve this problem?
by showing some initiative.
if you google for "php file upload" you can find lots of interesting things such as this one[^] which I have not read nor tried.
|
|
|
|
|
Yeah, that kind of upload I have
The question is more like, how can I write a C# application that postes a file to that php script?
|
|
|
|
|
|
I have an animated gif in a label that I wanted to use as visual feedback when doing some processing. For example if I try to get a list of servers in the network.
When ever I do some process the animated gif stops animating.
Do I need to run it as a seperate thread...if so can someone give me an example?
thanks in advance
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Hi,
GUI stuff has to be handled on the main or GUI thread; it is the time-consuming other things your app does that should be delegated to one or more other threads; real threads, or ThreadPool threads, or BackgroundWorkers. BTW: Such threads are not allowed to touch the GUI Controls, unless they use Control.InvokeRequired & Control.Invoke.
|
|
|
|
|
thx for the tip
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
hi all
i want 2 create an admin form by which admin can create user id nd password nd can assign d specific module of master page menu 2 aspecific user in ASP.net c#
manisha varshney
|
|
|
|
|
Sounds kind of asp.nety if you ask me...
|
|
|
|
|
Hi
I need to build chat program that will work in internal LAN
something like Messenger
where I can get sample code or help ?
thank's in advance
|
|
|
|
|
E_Gold wrote: where I can get sample code or help ?
Google.[^]
hmmm pie
|
|
|
|
|
Can you explain for me how can I create a tree in C# using this structure?
struct tree{
int num;
tree a[];
}
|
|
|
|
|
Hi.
How can we define a Shortcut key for a button ?
Thanks.
|
|
|
|
|
The usual way is to select one of the characters in the Text for the button and precede it with an ampersand.
For example, if the text you want for a button is 'Exit', typing it in as 'E&xit' causes the 'x' to be underlined and it automatically becomes the shortcut, 'Alt-x'.
I don't know of another way, although others might.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|