winforms

How do I gracefully exit WinForms app when hitting stop debugging in VS?

I'm writing a system tray Winforms app which does some very important cleanup on Application.ApplicationExit. When I hit the stop button while debugging in Visual Studio, this the process exits, but this cleanup code doesn't get called. Is there some way I can make sure it gets called in this situation? ...

Winform GUI Thread - Should there be a single catch block ?

I have read it here : CodeProject and some other places that there should be a single catch block per thread. I don't quite understand this in context of winforms. Is it true also in case of winforms? I understand that worker threads should have a single catch block. But, I have multiple catch blocks on the UI(main) thread which always ...

How can a string array be databound to a ListBox?

I'm relatively new to .NET GUI programming using WinForms (the project I'm working on is targetting .NET 2.0 for deployment reasons), and I'm trying to bind a ListBox in a Form to a string[] property that is defined in the form: namespace AVPriorityUI { public partial class AVPriorityUI : Form { public AVPriorityUI() ...

system.web inside of app.config file

I just upgraded my Windows Forms project from .NET 3.0 to .NET 3.5 and the upgrade added the following to my app.config file: <system.web> <membership defaultProvider="ClientAuthenticationMembershipProvider"> <providers> <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthe...

why form_closing() is firing twice?

I am working on a windows form application. I want to show user a message stating close reason when user clicks "X" button in the main window.With "X" button i mean "close" button in "minimize","maximize" and "close" tray in windows. I have written this code. private void frmIMS_FormClosing(object sender, FormClosingEventArgs e) {...

can two .NET exe interfere with each other?

I have two .Net applications running on client machine.One is IMSOperations and other is IMSInvoice.Both are windows forms application using C#. What happens is when both of these applications are running,after some time IMSOperations gets automatically closed. What i tried is to find reason of closing by subscribing to main form's For...

How to use SaveFileDialog asynchronously?

Hi guys, I have a windows forms application, with a button - on the button's event handler, I need to download a file with SaveFileDialog. But I need to do this asynchronously on a separate thread. So far, I came up with this code, but I don't know if my approach is flawed or OK: private void btnDownload_Click(object sender, E...

Drive select box with icons in windows form.

Is there any windows form control that shows list of drive letters with icons? ...

Programatically finding a message box and generating a click on a button

I am trying to automate testing of a winform application. I am running it in the same process as the test code, so it is fairly easy to find the .Net controls and simulate user action on them. I got however stuck a bit with a message box (created using the standard MessageBox.Show method). How can I get hold of it and simulate that a but...

Combo box with icons in windows forms?

Is there a combobox alike component that displays list of items with icons? ...

Two Way Binding on Multi-select WinForms Listbox?

I have a project where we are loading a multi-select listbox from a collection of objects. I have another entity object that has a collection that I want to bind to SelectedItems somehow. Is there any way to do this using object binding sources or some kind of binding source without writing code? Sure I can loop through the collection ...

Change Default Winform Icon Across Entire App

Can I change the default icon used on a Winform? Most of my forms have their icon property set to a custom icon. For the few forms that slip through the cracks, I don't want the generic "hey look, he made this in visual studio" icon. One solution is to tediously check every one of my forms to make sure they either have a custom icon s...

Sockets, Get Number of Bytes Available (c#)

Good afternoon, OK, short and sweet. I need to get the number of bytes available for read from a socket. I have setup a NetworkStream on my Socket Client but can't seem to find how to get the number of bytes that are available to be read, at the moment I can only get a boolean stating "Yes I have Bytes", or "No Bytes this time". But th...

Trouble with NativeWindow constructed in a thread context

I'm creating a NativeWindow subclass ('MyNativeWindow') in order to use its message pump to communicate with some old DLL. My code runs inside a WinForms application, but I'd like to keep the DLL and it's message processing outside the scope of the GUI. When creating MyNativeWindow from the application context (just before creating my a...

Is xaml in WPF equivalent of .Designer.cs in Windows Forms apps?

Is xaml in WPF equivalent of .Designer.cs in Windows Forms apps? Does it just provide compile-time state for the UI? I am not sure but it looks like you can do things programmatically with xaml at run-time. If I have a basic UI state where everything is added at run-time, then should I be looking outside the xaml stuff? ...

Transparency Problem by Overlapped PictureBox's at C#

Hi to all, I'm displaying in a panel pictureboxs overlapped, because each picturebox is used as a layer. First time a picturebox is defined and added to panel its backgroundcolor is transparent, and its images are empty. The problem is, the bottom layer can not be seen, the transparent image, shows the panel's ground. Excepted is that...

Adding an entry to the Left-Upper-Corner Icon menu in WinForms?

I have a WinForms app, and I would like to add a menu entry to the menu that opens when the user clicks on the upper left corner of a window (the Icon) or presses ALT+SPACE. Form only shows me a MainMenu and a ContextMenu, but no Icon Menu or something like that. Is there a simple way to modify this on a WinForms app? I'm talking about...

Trying to maintaining a DataSet in WinForm App

I am in the process of converting an in-house web app to a winform app for disconnected reasons and I hit the following snag. In the Function SaveMe() on the webapp there is the following code on the Person.ascx.vb page --> //get dataset from session Dim dsPerson As Data.DataSet = CType(Session.Item("Person" & Me.Uni...

Windows Forms: Making a cursor bitmap partially transparent

I want to use partially transparent images in drag/drop operations. This is all set up and works fine, but the actual transformation to transparency has a weird side effect. For some reason, the pixels seem to be blended against a black background. The following image describes the problem: Figure a) is the original bitmap. Figure ...

centralize report in winform application

I working on a winform app and would like the same reports available to others when the reports are edited or modified. Currently when a report is modified I have to re-deploy the app or copy the report file to a folder. I am looking for an alternative. Super users of the app have the option to go to design mode and edit the report. Is...