winforms

How to sort a binding source with joins?

I have a table called Tenants, and it has a field called PropertyID and UnitID. I also have a binding source for this table (Tenants), however I want it sort it, but the values I want to sort it by are not in the table itself. I want to do something like this: SELECT t.*, p.PropertyName, u.UnitNumber FROM Tenants t LEFT JOIN Propertie...

How to properly prompt the user when closing an MDI form and children?

I'm writing an IRC client, where there is an MDI parent with Server and Channel windows. When you close a Server window, it prompts the user and if they want to close it, the connection to the server is closed etc. I would like there to be only one prompt when the MDI parent is closed rather than a prompt for each server. The problem is...

Throwing events through objects

Hello! I'm developing a Windows Mobile 5.0 or above application with .Net Compact Framework 2.0 SP2 and C#. I have a Winform (Form1) with a control (Control1) that contains another control (Control2). For example, a winform with a panel and inside this panel there is a button, but in my case Control1 and Control2 are custom controls. ...

Customized WrapMode in DataGridView

I'm using an editable DataGridView Windows form to display a list of variables which can have different types of information, the format of which is unknown to the application: paths, strings, numbers, and so on. The form is using source data binding. Some of the values may be long, and I would like to display them on several lines rath...

Change ListViewItem Bounds

Hi guys, Is there any way to set the bounds of a all ListView items in LargeIcon mode to a specific size? I want to manually draw a rounded rectangle background for each of the items, but in the DrawItem event e.Bounds differs based on the state of the items. Thanks. ...

Add/Edit record visual example for WinForms

Hello, I have records which user can edit, or add new records. The add/edit screen isn't really suitable for a grid as it has a grid within it for lists of parameters the user can add. Does anyone have any good visual/UI paradigms for add/edit? I have the form for adding and above it I have a label "Add/Edit", but when the user select...

How to display clipboard information in WinForms?

What control can display clipboard items and files? I would like the items and files to be able to pasted on selection. And how do I set it so that history of items is shown and the program remembers the items copied on the clipboard. Sorry, I changed my mind to WinForms. I heard that WPF has a very steep learning curve, and since I a...

Change ToolTipText display duration

I need to show the tooltips over a datagridview cell and that is currently achived using the tooltiptext of the datagridview cell property. I just need to increase the default duration of time that is tooltip is visible any quick ideas please ...

Adding ConnectionString at runtime App.Config and display without reloading application?

Hi, We have an internal tool and we need to give the ability to add a connection string programmatically and then reload this connection string without reloading the application at all. I am kind of confused and wasted 2 days on this and about to give up I have done the following var config = ConfigurationManager.OpenExeConfigur...

C# Windows Application Doesnt Show In System Tray Correctly

Hi, i am trying to get a c# winforms application to startup only in the system tray but when i use the following commands it shows in the system tray but also shows as a little title bar just above the taskbar on the left hand side above the start button (windows xp) The funny thing is that it only happens when i run the application out...

Add text in textbox that will show only when clicked.

I load files to a TextBox, and I would like some of the information to be hidden and replaced with a LinkLabel (that says something like 'click me to see more'). only when the LinkLabel is clicked will the extra information be shown. the information to be hidden is marked with "/" in the file. Can you think of a way to do this? Is it pos...

Resource String Location

Where is the best location to place resource strings? Does it depend on scope? Currently most of our strings are being placed at the project level, but certain strings are only needed for one form. My thoughts would be that these strings should be placed as close to their use as possible. EDIT: This is a WinForms question. I've ad...

How can I create a single event handler for many many pictureBoxes on MouseEnter?

My plan is to create a single event that will go: "Ok, the mouse entered a registered pictureBox, load X picture onto it according the name of sender." What is the best way to handle this? Should I create a dictionary with the name as key, and the location of the picture resource as the value? Here's what I have so far: private void...

Make a BackgroundWorker do several operations sequentially without freezing the form

Hello I have already asked a somwhat similar question here but I now have a follow-up question. I need to launch the external program several times in a row, but I have several problems with it : It tried to simultaneously launch all the operations. I have put an empty "while (bgwkSVN.IsBusy) { }", it kinda works, but I'm pretty sure...

align the tab control to the right

is there any way that i can align the tab control to the right? by default, the tabs are to the left. can i change it to the right or centre.?? ...

Commit current dirty cell on clicking save button from any datagridview on form

I have a form with multiple datagridviews. On save the entire dataset will be serialized to a strongly typed property bound to a sql varbinary(max) Works fine. Of course the current "dirty" cell will not be saved as mentioned here : http://stackoverflow.com/questions/963601/datagridview-value-does-not-gets-saved-if-selection-is-not...

C# RichTextBox strange behaviour

greetings, for the first time ever im investigating RichTextBox control in C# windows forms. i know i need this control in my app as textBox is to simple for my needs. i have the followig code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using...

How do I automatically have the build date inserted at design time

Hope fully the title was somewhat descriptive. I have a winform application written in C# with .net 2.0. I would like to have the last compile date automatically updated to a variable for use in the about box and initial splash box. Currently I have a string variable that I update manually. Is there any way to do this? VS2008 .net 2.0 ...

Report loses color when exporting to Excel

Hi, I have a local report in a WinForms application that is giving me some trouble. On this report, I have a table and I am trying to change the BackgroundColor of the Detail row. When I change it to "Red" and view the report, the row is Red as hoped for. When I export the report to Excel and PDF, the row is Red, too. So far, so g...

Is this the best way for me to set events for my controls?

I'm setting them during runtime, I'm kinda afraid that this will bog down my application eventually. Is there a better way? public MainForm() { InitializeComponent(); SetPictureBoxEvents(); } private void SetPictureBoxEvents() { Andromeda.MouseEnter += new EventHandler(HeroMouseEnter); ...