winforms

Problem with controls in MDI form

I have placed a button on MDI form , now when I open a child form , the button remains on top and distracts the child form , is there a way to solve it? I have done following to send the button back when any child is activated.But I am wondering to call button1.BringToFront(); private void MDIParent1_MdiChildActivate(object sender, Even...

mdiparent click

The click ,double click on mdi parent of the .net MDI form does not work is it a bug? ...

How to show a message box on an invalid filename entered while saving a file using save file dialog

Hi all i have written a code to display a message box if invalid characters are entered while saving the file but my message box is not displaying. Actually i will have a save file dialog option to save a file if the filename starts or consists of the following \\/:*?<>|" I would like to display a message box as invalid...

How to properly escape SQL when using BindingSource's Filter property

I've inherited a C# application that lists data from a database table via a DataGridView. There are also a few text fields used to filter that data. This is done like so: String listFilter = string.Format("City = '{0}'", this.toolStripSearch.Text); this.customersBindingSource.Filter = listFilter; toolStripSearch is a text field for se...

How can I remove accelerator characters from a string?

I have a caption for a GUI control, and I want to convert it to a simple text string. Specifically, I want to remove the accelerator metacharacters. For example (examples assume WinForms): Strip off single occurrences of the metacharacter: &Yes becomes Yes Convert double occurrences to single: Income && Expense becomes Income & Expens...

Architecture for application that supports multiple user-input properties

I've been puzzling over how best to architect an application I'm due to begin work on shortly and nothing simple is coming to mind. Maybe someone else can see something that I'm missing. The objective is pretty simple -- construct an app in C#/WinForms to allow the user to specify a file to be loaded, then visualize that file's content...

How to tell if Shift is being pressed in a MouseDown event?

This really should be easy, but I can't see any obvious or intuitive solution: I am catching a MouseDown event on a control, which gives me a MouseEventArgs object in the signature. Now I want to be able to tell if the user was holding down the "Shift" or "Control" key when they clicked. But the MouseEventArgs object doesn't contain a...

Windows Forms ComboBox - case insensitive data-binding

If I'm databinding a winforms combo box, is there a way to make the binding case insensitive? For example if the combo box is bound to a property whose value is FOO, get it to select combo box item with value of Foo? ...

What would be the easiest way to generate new localized resource files?

Hi, My windows forms application consists of one Visual Studio solution and several projects. The application is localized in English and French using resource files (each project has global resource files, e.g. fooResources.resx and fooResources.fr.resx, and each form/user control has its own resource files (e.g. fooForm.resx and fooF...

How to bind one control to another?

I have a checkbox with a Checked property and a Listbox with an Enabled property. I'd like to data bind the controls in such a manner that when the user checks the Checkbox, the listbox becomes enabled. Conversely, when the user unchecks the checkbox, the listbox becomes disabled. How can I do something like that? ...

How to trace that all child controls (were) shown

I'm developing a standard wizard control. That control can contain several panels. Depending on the step, a panel number (step) shows. My difficult thing is that each panel contains several child controls (and controls can contain child controls etc). I need to trace a moment when all child controls of a panel (were) shown. How ? Do Sh...

in windows forms, is it possible to load a form so its located in another form?

lets say i have a main form which have a lot of functionallity. this form have a tab control in which each tab contain some set of functionality. what i want to do is when i click on each tab controls button i want to load a form into the client area of the tab control. so instead of having a lot of controls in the main form , i will onl...

Why is the modifier set to Friend in Winforms?

When adding a new control to the designer in Winforms, the modifier on the control is set to Friend, but the default modifier is Private (right clicking the property and resetting the modifier). Does anyone know why? Is there a setting to set the modifier to default (Private)? ...

Is BizTalk feasible for this?

Hello All, My team is planning to use Biztalk server 2006. The task is as follows:- Run a scheduled job every night which fetches from multiple databases a set of data (basically the same select query with a where clause run for about 20000 Id's) and writes it into an xml. Presently we have c# winform which does the same for one or mu...

Position of BackgroundImage in Windows Form

I am setting the BackgroundImage of a Windows Form to a 200 x 200 image. The Form is 500 x 500. I want the image to be anchored in the bottom right corner of the form. However the only option available to me is the BackgroundImageLayout property - setting this to 'None' results in the image being anchored to the top left. How can I chang...

Converted copied text from textbox in c#

I want to convert text which user is copying from my textbox. For example: text of myTextBox is "12,34" and I want to give user: myTextBox.Text.Replace(",",".") <. "12.34" Then he could paste this text anywhere in this format (for example in webbrowser). Anyone know simple way to do this ? Thank you ...

XtraGrid. apply filter by enter key

Hello, guys I use devexpress XtraGrid and auto-row feature. At documentation I see: "You can also specify whether filtering should be applied immediately after changing a value or only when end-users press the ENTER key." I would like implement second behaviour, but I don't find any properties for this. So how can I achieve this behavio...

Showing Progress Dialogs - What is the best approach for Office addins

I have a .NET based Excel addin that displays a custom toolbar in Excel. There are about 30 commands that can be executed through this toolbar. The commands are executed on the same (Excel) thread. I want to display progress dialog for some of the commands that take some time to execute for which I used a non-modal dialog. The dialog wo...

Round shaped buttons

hi, How do I make a button in a round shape rather than the conventional rectangle. I am using winforms(2.0) ...

MDI Child form not getting minimized

I have an MDI form and several number of child forms inside that MDI. On clicking a button in the menu, a form opens. If another form is already open then that should get minimized and the new from should open. The problem is even if i give frm.WindowState=WindowState.Minimized, the form does not get minimized. The code that I have writt...