winforms

Bring another processes Window to foreground when it has ShowInTaskbar = false

We only want one instance of our app running at any one time. So on start up it looks to see if the app is running and if it is, it calls SetForegroundWindow on the Main Window. This is all good and well ... for the most part.. When our app starts up it will show a Splash screen and a Logon form. Both of these forms have ShowInTaskBar ...

Console.Write Not Working In Win Forms App

I created a VB.NET Windows Forms Application in Visual Studio 2008. When I run my program from the command-line, I get no output (only the next prompt). What am I doing wrong? Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Debug.Write("Foo") Debug.Flush() Console.Writ...

Prevent Console Return

Can a VB.NET Windows Forms Application be configured so that when run from the command-line, the command-line waits until the application exits before showing the next prompt? ...

Odd form closing behavior when using taskbar's Close All Windows

I have a Windows Forms app with a main window and 0 or more other windows open. The other open windows are not owned by the main window nor are they modal dialogs or anything. However, the default behavior is if the main window closes then the application closes due to the Application.Run method returning. That's fine, but because the...

With the .NET "WinForms" SplitContainer control, how can I hide a panel dynamically?

Calling MyPanel.Panel1.Hide(); or MyPanel.Panel2.Hide(); simply hides the controls inside the panel... but I want to have the other side of the panel fill up the whole space. So, if I hide Panel1, I want Panel2 to take up the whole space, and I want the splitter to disappear. Is that possible, if so, how? ...

Drawing problem does ShowWindow(hWnd, SW_HIDE) automatically invalidate rectangles?

Hello, I'm running into a problem where, I have a Window that contains a child window. The child window contains another child window where a video is playing using Windows Media Player. Whenever I do call ShowWindow (hWnd, SW_HIDE) on the parent Window and paint over the entire surface, the region occupied by the grand-child window (whe...

Progress bar in data grid view

Is there a way to have a progress bar in a cell in a DataGridView? At design time, you can add a TextBox, Button, Image, Link, ComboBox, or CheckBox, but not a ProgessBar. Is there a better control in WPF that will allow this? ...

"Z-Index" in winforms

In CSS, we have a Property called z-index, what is the same in Winfrom set for a Panel control to the "Z-Index? ...

c# control location precision

I need more precision then integer based locations when puttng controls on a form. It seems control.location only supports Point. Is there a work around for this? Point p = new Point(100, 200); this.Location = p;// this works of course PointF pF = new PointF(100.04f, 200.08f); this.Location = pF;// this does not work of course because ...

Winforms MVP with Castle Windsor - DI for subforms?

I'm building a winforms app utilizing passive-view MVP and Castle Windsor as an IoC container. I'm still a little new to dependency injection and MVP, so I'm looking for some clarity... I have a main form which contains a number of user controls, and also will bring up other dialogs (ex. Login, options, etc) as needed. My first questi...

WinForms prints to default printer even if it's not available/connected

How can I determine if printer is connected? Typically this application prints to the default printer but in some cases that printer may not be available. If so I don't want the job sent to it's queue but rather printed to another available printer. I understand the PrinterSettings.InstalledPrinters property. Does PrintDocument.Printe...

Accessing form's resources (resx file) from code

If I have a form Frm1.cs that is using some icons, images or other resources, these resources get stored in the form's resx file (Frm1.resx). My simple question is how do I access these resources from code? As a workaround I can store these resources in the Project resource file and they will be available via Properties.Resources.reso...

Automating Disk Cleanup on Windows using commands

Hi, I asked this question on MSDN forum but there was no response.. Maybe I had posted in the wrong forum... So I'm posting it again here, hoping that someone might be able to help me out here... I am trying to run Disk Cleanup in the command prompt (and through a C# program) and so I went through all the available options from this li...

Unifying ToolstripButtons and ToolstripMenuItems

Hi, Almost in all cases, ToolStripItems do just what their equivalent MenuStripItem do. In these cases, ToolTip, icon and text of these two commands are the same. So, is there any way (preferably a .net native way) to synchronize and unify these two items? This might be a way to define commands somewhere else and just put them into vari...

simplified setup feature in Visual C# 2010 express

Hi all, i just try visual studio c# 2010 express edition. According to the website, this express edition support simplified setup. Can someone explain to me how to use this feature in express edition ? Thank you. ...

C# disable Alt+F4 but allow the the form to be closed by code, CloseReason.UserClosing is not helping.

Hi, I want that the form will not close by doing Alt+F4 but if Application.Exit() or this.Close is called from the same Form, it should be closed. I tried CloseReason.UserClosing but still no help. ...

Windows.Forms RichTextBox Control - Avoid inserting large data.

I have a Windows Form with a RichTextBox on it. The content of the RichTextBox is written to a database field that ist limited to 64k data. For my purpose that is way more than enough text to store. I have set the MaxLength property to avoid insertng more data than allowed. rtcControl.MaxLength = 65536 Howevery, that only restricts t...

Porting existing Windows Forms application to Web

We have an application we are developing for a very long time written using Windows Forms which consists of many panels as user controls. Is there a way to offer controls using a web browser with a minimal effort? ...

C# - Determine if class initializaion causes infinite recursion?

I am working on porting a VB6 application to C# (Winforms 3.5) and while doing so I'm trying to break up the functionality into various classes (ie database class, data validation class, string manipulation class). Right now when I attempt to run the program in Debug mode the program pauses and then crashes with a StackOverFlowException...

What's the purpose of Winforms controls tags?

I see a 'Tag' property in the design view for most WinForms controls. I have never used this tag and want to know why I would want to use it. ...