winforms

Windows Forms Textbox Refresh...

I have a textbox on a Windows Forms UserControl that I am trying to update the contents of from elsewhere in my solution. I am dynamically adding the UserControl to my form, and I have a static Instance property on the UserControl so that I can access it from a referencing library. I have excluded double-lock checking here for brevity....

Embedded PDF Viewer in a WinForms Control

I'm trying to embed a pdf viewer in a WinForms Control in such a way that I can display the pdf to the user within the context of my application. I also need to prevent the user from copying text, printing, or saving a copy (sensitive data). Thus far I've tried using a WebBrowser to host the Acrobat Reader activex control. This gets m...

How I start my winforms app via telnet?

I have a windows forms application on a client machine. I am trying to log in via telnet, shut it down, update some files, and restart it. Using cmd on the client machine and typing in MyApp.exe works great to start it. But if I do this in the telnet window something odd happens: The application starts in as far as it is now in the pr...

Resizable table layout panel in c#

I find the table layout panel in c# (.net 2.0) to be very primitive. I wanted to allow my users to resize the columns in a table layout panel but there are no ready made options to do so. Is there a way atleast to find out whether the cursor is directly over any borders of a cell and if so, which cell is beneath it ?? May be having this ...

WinForm designer and right snapline for controls in container when resizing it...

Using Visual Studio 2008 WinForm designer, I have a container (form, panel, groupbox, whatever) and some controls in it. The container is set to not automatically resize or dock in any way. When placing a control in the container I can use the snaplines to help in positioning the control. However, the snaplines does not appear when I r...

How do I use the RichTextBox control?

I want my users to be able to enter text in a Rich Text box and the RTF output be saved to the database. Currently I have the RichTextBox bound to the field in the database, but it strips formatting when it's saved. How can I prevent this? Also, how can I attach a formatting toolbox, (like what's in Wordpad) so my users can change the ...

Would MEF work for a product?

We have developed a product (Core). We extend and override functioanlity in Core to create bespoke applications (Product). Product has a reference to Core so it can inherit from the base forms and override the functionality. Would MEF be n advantage here or is it more for plug-ins? Thanks, B ...

Using a BindingSource in a UserControl

I have a UserControl with multiple fields that I would like to have bound to a BindingSource. I would also like the UserControl to expose some BindingSource property so that it can be dropped on a Form and be bound to the BindingSource on the form. Is there an easy way to do this? I realize that I can rebind all of the controls of the...

MVVM for winforms

Should MVVM be used for WinForms? If so, what is the advantage over using MVP? ...

Update Winforms UI from background thread result

This is probably a silly question, but I could not find an answer on stackoverflow. I have a button click event in a Winform app that runs a thread to caclulate a result to display in a form. How do I update the Forms UI when the thread has calculated the result? private void btnRequestR2Approval_Click(object sender, EventArgs e...

Setting the owner of a dialog box in WinForms and C#?

I have an EXE (app.exe) that calls a COM exposed method in a C# DLL (lib.dll). Lib.dll shows a dialog box. How do I make the dialog box (not a windows message box) recognize the app.exe as the owner, so that when app.exe is minimized, so is the dialog from lib.dll? The dialog cannot be modal. Is this a problem that can be solved with ...

How do I create an editable databound combo box in a DataGrid in WinForm

I have a noob question. I have a WinForm (.net 2.0 in VS 2008) on my from I have a DataGrid One of the fields in that datagrid is a combo box that is bound to a separate table. this works, but I am unable to edit or add, I cannot add a value that is not on the list. I am looking to create a lookup box for lack of a better term. The ...

WebServices fail because (400) Bad Request because of special character.

Using Visual Studio 2008, I setup a client that uses Web Services. It has nothing to do with buffer sizes (as that is a typical response, all appropriate sizes were increased). I was using a List as the parameter of the Method. After much experimentation, I used the System.Net.WebClient to manually create a Soap 1.1 and a Soap 1.2 reque...

Placing Image control in MDI form

Hi, I have placed an image controls in center the mdi. But when I an opening a child form the form form appears below the image control. Please help ??? ...

Entity Binding in Winforms - one to many

I'm struggling with the Entity Framework when creating a new record in a one to many relation. I've the following tables defined: Person PersonInternetAddresses InternetAddresses The Entity Framework has created the EntityObjects Person with a navigation property named PersonInternetAddresses and InternetAddresses with a navi...

Databound combo SelectedItem doesn't seem to work.

I'm attempting to bind a combo to a collection of objects: Dim t As New TradeOrderStatus() Dim ts As List(Of TradeOrderStatus) = t.GetStatuses With Me.cboTradeStatus .DataSource = ts .SelectedItem = Nothing End With This works fine and I see the list of items in the combo. However when I try to set the...

Disable buttons on MDI Parent Window when the child window is Shown

Hi Guys, I've created a Mdi window with a panel. On this panel i've placed some buttons which open different child forms. The problem i'm having is that I only want a user to be able to open one child form/window at a time. I have been disabling the buttons on the buttons click event to open the child window and enabling them again on t...

Windows Forms DataGridView control have different control types in the same column

Is it possible to do the following in a DataGridView: In the same column I want to change the control type of each row between DataGridViewTextBoxColumn and DataGridViewComboBoxColumn? (this is because sometimes I want to display a drop down list and other times I just want the user to enter a freehand value). Thanks, P.S. I am using...

How to capture screen with timer using C#?

This is a Windows application using C#. I want to capture a screen shot with a timer. The timer is set to a 5000 ms interval. As the timer is started, the desktop screen should be captured with the source window caption. try { System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Tick += new EventHandler(tim...

Best way to hide a toolbox associated with a UserControl in .NET 2.0?

I've recently come across the following situation. I have a UserControl that can show a modeless toolbox. If the user has shown the toolbox, I'd like to hide and show it appropriately as the UserControl itself becomes invisible or visible, respectively. The UserControl can be embedded in an arbitrary number of parent containers, such ...