winforms

Data Binding and controls

We have the following operation to be performed on the control in our WinForms application. public class BindableDataItem { public bool Visible {get; set; } public bool Enabled {get;set;} } Now we want to bind the BindableDataItemto a TextBox. Here are binding association. TextBox.Enabled <==> BindableDataItem.Enabled TextBo...

Deploying default settings for different customers

My question is sort of linked to this existing question http://stackoverflow.com/questions/1262836/how-to-deploy-a-desktop-net-application-with-custom-settings-per-user However, I understand the idea of using Application Settings what I can't find information on is, how should I deploy the application settings for different customers? ...

Change the cell border width and also make the cell border only all,left ,right,top,bottom or none

Change the cell border width and also make the cell border only all,left ,right,top,bottom or none in winform datagridview. In datagridview the problem is to change the border style of each cell , as we could do in excel sheet. I have tried following but it didnt work. DataGridViewAdvancedBorderStyle mystyle = new DataGridViewAdvancedBo...

Winforms Custom User Control

I tried to create a custom user control in c# that handles other controls that are added to it. The custom control consists of two panels. What I'm trying to achieve is, that if another control is dragged to my user control in design mode (or added programmatically at runtime) I want that control to be placed on one of the panels. I tri...

My.Forms Question.

My current project has 10 or so forms, however when using the itellisense within visual studio only 3 show up within the My.Forms property. I would have imagined that the forms would have been added to this as they are added to the project. Is there a setting somewhere which needs to tweaked to ensure they show up? ...

Call a Messagebox.Show() from PowerShell with more than default button?

I am trying to show a message box from PowerShell with yes and no buttons. I can display a message box with an OK button: [system.windows.forms.messagebox]::show("Hello, world!") And I can create a variable $buttons with the buttons I want: $buttons=[system.windows.forms.messageboxbuttons].yesno And I can see that the Show() stati...

Get highlighted text from active window

Hi, I would like to know how can I get highlighted text from any window for example: (excel, ie, firefox,…). please note that the following message not work in the above application WM_GETTEXT,WM_COPY,EM_GETSELTEXT. I have also tried control C (copy) and get selected text from clipboard but it is not a good idea. Language used: C# ...

Print Preview Button Zoom Always Has "Auto" Checked

I have looked far and wide for a way to control the zoom aspect of the print preview dialog. Unfortunately, even after the following two lines of code: PrintPreviewDlg.PrintPreviewControl.Zoom = 1.0D; PrintPreviewDlg.PrintPreviewControl.AutoZoom = false; The zoom drop down button is still set on "Auto" instead of 100%. This seems like...

Client-Server Application with Plug-in Architecture

I am thinking about a plugin model for my client-server application. A plugin will have a UI part(for configuration, runs on client) and an execution part(does the work, runs on server). For simplicity, I'm trying to figure out if I can locate my plugin DLL on the server side, but still show the UI on the client side. I thought about ...

What is the accepted pattern of killing background tasks in a WinForms app

I got a .net WinForms application. I have a UserControl which gets instantiated based on user action - upon instantiation, it performs some time-consuming tasks on a background thread (using BackgroundWorker), while displaying the ajaxy spinning animation. The user can click away at anytime, then click back onto the user control (which...

Passing objects between winform objects

Hello, I'm hoping someone has come across this same predicament I've encountered. I'm developing a .NET 2.0 Winforms application and am trying to exchange an ADO.NET datatable object between two different winforms. I've got a button on form1 that when clicked, instantiates a different form object and shows it modally. The second modal...

Cannot access a disposed object

Cannot access a disposed object Anyone know why I would get this error "Cannot access a disposed object" on this line of code Invoke(new UpdateTimerDelegate(UpdateTimer), new object[] { null }); Hit start over then either accept / reject / or close the form -- seems to happen when closing the form the error happens when you bring th...

Contextual or Drop down window

I am elaborating on how to set the window style to behave like the context menu or the combo-box drop down list - to be able to close when user clicks outside the window area or presses Escape but I have found no clue. I have already used the ToolStripDropDownButton to simulate this behavior quite well but there is one big issue that th...

Display multiple UserControls with the same name in the Visual Studio WinForms designer toolbox

In my WinForms project I have multiple UserControl-s with the same name ("View"), in diferent namespaces. If I understand well, the designer hides the controls with the same name as the designed control from the toolbox. So when I'm in design mode on one of the "View"-s I don't see the other ones. Is there a way to change the name disp...

How to add custom property and events to a control say textbox or button.

I want to add a custom property to a button in window form. Currently i am using following code to create my logic. but i want to create an enum value for a button control. btnPartyDetails.Text = "View"; {} btnPartyDetails.Text = "Add"; {} btnPartyDetails.Text = "Delete"; {} btnPartyDetails.Text = "Edit"; {} I want to perform som...

Multi selection list box in WinForms

Hi I am looking for way to implement multi selection enabled list box in windows forms C#. Any suggestions? Thanks. ...

Problems with MDI in Windows XP

I'm working on a .NET 2.0 WinForms app that uses MDI. It works perfectly when I'm testing it under Windows 7, but when I install the exact same application in Windows XP the child windows are no longer MDI windows. I can drag them out of their parent window. Does anybody have an explanation for this odd behavior? Update: It works on W...

Last item in a bindingSource is not updating a combo box.

I have a combo box bound to a Data Source (clientInfoBindingSource) for its selected item and text, I am using a auto generated Binding Navigator on a different Data Source (totalsBindingSource) and on this.totalsBindingSource.CurrentChanged += new System.EventHandler(this.updateClientInfo); it should update the current object for cli...

Why is "My" namespace unavailable?

Our Winform app consists of a Main.exe and a Launcher.exe. The purpose of the Launcher app is to check for updated versions of the Main.exe. If it finds no updates it launches Main.exe using System.Diagnostics.Process.Start If it finds an update, it copies the new Main.exe into position and launches Main.exe the same way (in this case ...

.NET Dock Panel?

Trying to find a dock panel/window widget like Visual Studio uses for its Toolbox/Properties/Solution Explorer/etc windows. Is there seriously not one already part of the .net framework? Or am I blind? If not, is there one you can recommend for me to download? ...