Click here to Skip to main content
15,913,055 members
Home / Discussions / C#
   

C#

 
AnswerRe: Crystal report not displayed in Windows 2008 server with C# .NET 1.1 Pin
Srinivasan Raju11-Nov-09 6:49
Srinivasan Raju11-Nov-09 6:49 
Questiontransparent colors in windows applications in c# Pin
hosseinghazanfary8-Nov-09 20:22
hosseinghazanfary8-Nov-09 20:22 
QuestionHow to Generate FFMPEG dll Using C#.NET or How to make a FFMPEG dll in C#.net where the code is written in C++ Pin
balaji_vbr8-Nov-09 20:14
balaji_vbr8-Nov-09 20:14 
AnswerMessage Closed Pin
8-Nov-09 21:31
stancrm8-Nov-09 21:31 
GeneralRe: How to Generate FFMPEG dll Using C#.NET or How to make a FFMPEG dll in C#.net where the code is written in C++ Pin
balaji_vbr9-Nov-09 19:41
balaji_vbr9-Nov-09 19:41 
GeneralRe: How to Generate FFMPEG dll Using C#.NET or How to make a FFMPEG dll in C#.net where the code is written in C++ Pin
phong.cntt22-Feb-11 3:17
phong.cntt22-Feb-11 3:17 
AnswerRe: How to Generate FFMPEG dll Using C#.NET or How to make a FFMPEG dll in C#.net where the code is written in C++ Pin
DanielTaylor12321-Jun-10 22:58
DanielTaylor12321-Jun-10 22:58 
QuestionThread "BringToFront" Pin
damichab8-Nov-09 19:49
damichab8-Nov-09 19:49 
Hi,

I have an interesting problem.

I have a tray utility program with various menu options that in turn bring up different dialog boxes. I want each dialog box to work as if they were modeless, but track them as if they were modal. I have solved this by making each box modal but have them on individual threads with a boolean to track if it is open or not.

Some code...

#region Configure MenuItem

private bool MyFormStarted = false;
private MyForm MyDlg;

private void MyDlgMenuItem_Click(object sender, EventArgs e)
{
    if (MyFormStarted)
    {
        if (MyDlg.InvokeRequired)
        {
            MyDlg.BeginInvoke((ThreadStart)delegate()
            {
                //MyDlg.Show();
                //MyDlg.BringToFront();
                //MyDlg.Focus();
            });
        }
        else
        {
            //MyDlg.Show();
            //MyDlg.BringToFront(); 
            //MyDlg.Focus();
        }
    }
    else
    {
        MyFormStarted = true;

        new Thread(new ThreadStart(delegate
        {
            MyDlg = new MyForm ();
            MyDlg.ShowDialog();
            MyDlg.Dispose();

            MyFormStarted = false;
        })).Start();
    }
}

#endregion



I have a block of code similar to this for each dialog that the tray utility is to open. By doing it this way, I can allow the opening of multiple dialog boxes at the same time while ensuring that each dialog can only be opened once.

What the problem is though, I cannot work out how to put the selected dialog on top. I have rem'ed out the MyDlg.Show() because this does not seem to work. I have tried

MyDlg.BringToFront(); 
MyDlg.Focus();


As well, but while the form obtains the focus, I cannot get it to display on top. I think it might have something to do with the threads.

So I guess ultimately my question is this: Is there a way to bring one thread in front of the other as 'BringToFront' would do to to the form?

Obviously, I will have to use a private class variable to hold the thread instance, but then what should I do with it.


Regards,

David
AnswerRe: Thread "BringToFront" Pin
Shameel8-Nov-09 23:58
professionalShameel8-Nov-09 23:58 
GeneralRe: Thread "BringToFront" Pin
damichab9-Nov-09 11:27
damichab9-Nov-09 11:27 
QuestionSetting DHCP options programtically using C# on Windows 2008 server [modified] Pin
Ganesh_T8-Nov-09 19:18
Ganesh_T8-Nov-09 19:18 
QuestionTravering a array in C# Pin
Pavan Navali8-Nov-09 18:28
Pavan Navali8-Nov-09 18:28 
AnswerRe: Travering a array in C# Pin
Gerry Schmitz8-Nov-09 21:38
mveGerry Schmitz8-Nov-09 21:38 
AnswerRe: Travering a array in C# Pin
Luc Pattyn8-Nov-09 23:26
sitebuilderLuc Pattyn8-Nov-09 23:26 
AnswerRe: Travering a array in C# Pin
Shameel9-Nov-09 0:12
professionalShameel9-Nov-09 0:12 
QuestionDataGridViewComboBoxColumn not showing the contents Pin
sachinkalse8-Nov-09 18:00
sachinkalse8-Nov-09 18:00 
QuestionAlberto Venditti :I got the given sample code but when I am running the program ,the Host name and ,OFF,ON are not displaying on the Grid Control Pin
medara8-Nov-09 15:53
medara8-Nov-09 15:53 
AnswerRe: Alberto Venditti :I got the given sample code but when I am running the program ,the Host name and ,OFF,ON are not displaying on the Grid Control Pin
Wes Aday8-Nov-09 17:36
professionalWes Aday8-Nov-09 17:36 
QuestionC# Program Being Linked with Wrong .NET Version Pin
Richard Andrew x648-Nov-09 12:02
professionalRichard Andrew x648-Nov-09 12:02 
AnswerRe: C# Program Being Linked with Wrong .NET Version Pin
Abhishek Sur8-Nov-09 12:19
professionalAbhishek Sur8-Nov-09 12:19 
GeneralRe: C# Program Being Linked with Wrong .NET Version Pin
Richard Andrew x648-Nov-09 12:24
professionalRichard Andrew x648-Nov-09 12:24 
QuestionCreateProcess API for C# .NET? Pin
Krischu8-Nov-09 7:11
Krischu8-Nov-09 7:11 
AnswerRe: CreateProcess API for C# .NET? Pin
Dave Kreskowiak8-Nov-09 7:25
mveDave Kreskowiak8-Nov-09 7:25 
GeneralRe: CreateProcess API for C# .NET? Pin
April Fans9-Nov-09 21:16
April Fans9-Nov-09 21:16 
GeneralRe: CreateProcess API for C# .NET? Pin
Dave Kreskowiak10-Nov-09 1:01
mveDave Kreskowiak10-Nov-09 1:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.