winforms

DataGridView on WinForms throws exception when I delete a record.

Hello. I have not done a lot with WinForms so I wonder if someone could give me a little assistance with this. I have a DataGridView that is bond to a IList<>. When I delete a selected record from the collection (ILIST<>) I get the following exception: "System.IndexOutOfRangeException:Index 3 does not have a value" I think my binding ...

How track when any child control gets or loses the focus in WinForms?

I have a Windows Forms custom control which acts like a panel in that it can contain any number of children. The number and type of the child controls are determined at runtime and so I need to work in a generic manner without knowing the exact child controls that might or might not be present. I want to alter the background color of my...

How can I display a tooltip showing the value of a trackbar in WinForms

I'm new to C# and WinForms so please excuse me is this is a bit of a newbie question. I'm trying to add a tooltip to my TrackBar control which shows the current value of the bar as you drag it. I've instantiated a ToolTip object and tried the following handler code but it doesn't show any tooltip: private void trackBar1_Scroll(object s...

On having more than one "application" accessible within a single basic form

I have two essentially separate applications for configuring two pieces of hardware sold by this company. I've been asked to put the two applications together so that they can be accessed from within the same program in such a way that both are accessible. An analogy to the idea would be opening a program, selecting a file to open, then...

Parenting a .NET form to an HWND.

I'm developing a plugin (C++/CLI DLL) that runs inside of an certain applications, about which I only know the HWND. My plugin shows various .NET forms that I'd like to behave as children of the main application (e.g. centered to the main window, etc). Here's what I've tried: // MyDialog.h public ref class MyDialog : public System::Wi...

Infragistics UltraWinGrid EmptyDataText Equivalent?

We're using Infragistics UltraWinGrid as a base class for customized controls. One of the projects that will use this control to display search results has a requirement to display a user friendly message when no matches are located. We'd like to encapsulate that functionality into the derived control - so no customization beyond setti...

Strange exception coming out of OdbcConnection.Open()

Bashing our heads against the wall here We are an ISV and have hundreds of companies using our software with no problems. The software is Winforms/C# on .NET 2.0. One of our clients has installed our software and it crashes on startup on all of their machines, apart from on one guy's laptop where it works fine. On calling OdbcConnecti...

Non-abstract event defined in abstract class won't show in Designer for derived classes

I'm using the class listed below to create a UserControl wrapping a ComboBox that can accept a List<T> and return an object of type T when the internal ComboBox's selection is changed. Everything works fine in code, exactly as I expect it to, but I can't get SelectedItemChanged event to show up in the Designer anymore when using my con...

move from form to user control

I have a bunch of Forms that I embed in tabpages(some are embedded two and three layers deep) that I now suspect are giving me trouble. I have been told that User Control's are the better approach. Now I am wondering how I canaccomplish this as quick as possible. Is it as simple as copy and paste? Has anyone ever done something like...

Windows forms: how to do a thick blinking cursor on a textbox?

I am rewriting a windows forms application (updated framework, rewrote the logic, etc.) and there is one thing that I just can't figure out how they did. Textboxes in the original application had a thick blinking cursor like so: http://screencast.com/t/8QYUcjuh3n For the life of me I can't figure how to do this. Please help? ...

.Net Windows Forms - Limit form navigation while waiting on asynchronous work.

On clicking a button, a query is executed in a background worker. It is asynchronous so that I can change the button to "Cancel" so the user can cancel the process if it runs longer than expected. This all works fine. But, I do not want the user to be able to navigate away from this location to do other things on the form. They must ...

Drag-Drop and two forms. How can I detect when the drop has happened in outside app.

I've got a WinForm where the user has the ability to drag an item from it to a different application. In my case the second application is SolidWorks. I have no problem getting the drag part working. The user is able to drag the part from my application to the SolidWorks drawing, but I want to close my WinForm when the user has dropped t...

Custom Drawing of (multi-layered)Embedded TabControls Error

I have a winform app that has tabcontrols that are 3 layers deep. I am dynamically coloring the tabs with the below class. When it goes to color an embedded tabcontrol it pitches a fit. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.Windows.Forms.dll Do I need to do something different f...

How to get a form from MainWindowHandle?

I have a program that only allows one instance of itself to run. I use this code bool createdNew = true; using(Mutex mutex = new Mutex(true, "MobilePOSServer", out createdNew)) { if(createdNew) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ...

Apply property setting to all like controls in Project in Visual Studio

Lets say I have multiple DataGrids throughout my winform app and I want to set the BackColor on ALL of them to Purple in Visual Studio. What is the fastest way of setting a Property for multiple items NOT located on the same Form? Thanks! ...

Progress Bar help

Hello, I'm very much new to programming and have been doing fairly well so far. But progress bars still confuse me. The web unfortunately has to many differing examples for me to get anything out of them. Some say to use background worker some don't, etc. Below I have what I THINK should work but doesn't. Its just supposed to she a progr...

AutoSize ElementHost in Excel 2003 ActionsPane

Hi, I'm hosting a WPF chart in an Excel 2003 ActionsPane. The chart is set to stretch both horizontally and vertically, however, although the ElementHost and the chart fill the ActionsPane horizontally, I have not found a way to enable the ElementHost to fill vertically. The only property that seems to have any affect on the layout of t...

How Do I Get the Selected DataRow in a DataGridView?

I have a DataTable bound to a DataGridView. I have FullRowSelect enabled in the DGV. Is there a way to get the selected row as a DataRow so that I can get strongly typed access to the selected row's values? ...

C# WinForms Print Entire Form

I have a single window, WinForms app (with multiple text boxes) and I need to print the entire form once a 'Print" button is clicked. I have looked up examples to do this but I cannot find anything that will print the entire form including all text boxes. Is there a simple way to do this? ...

Drag and drop from an email file attachment in GroupWise to a .NET application

I'm trying to allow an attachment from an email open in Novell GroupWise to be dropped into my C# WinForms application. The standard .NET functionality doesn't work. In the DragDrop event of a control, e.Data.GetFormats() returns the following. FileGroupDescriptorW FileGroupDescriptor FileContents attachment format I can get the file...