winforms

Binding Grid to a Linq Datasource from Winforms (.net)

Back in the old days (i.e. last month) I'd bind my winforms grid to a dataset and be off and running. By default the grid contents could be updated. (similar to an Excel spreadsheet) But, if I bind a grid to a Linq datasource (either Linq to SQL or Linq to Entities) my winforms grid is locked into a read-only mode. How can I enable an...

How to attach a winforms dialog to an existing toolbar/menubar (compiled C++ app)?

To attach a winforms dialog on Microsoft Wordpad toolbar/menubar? ...

Refactoring method that binds controls to LINQ

I have a function that binds LINQ results to the controls on my form. The below code works but I just can't get over the feeling I should be slapped for the copy/paste aspect. Can someone help me with what i need to do to deodorize this? Thank You! private void BindDataToForm() { // Bind data to form CaseNotesData...

How to structure survey data?

Note: this is NOT like this question I've been tasked to construct a survey that our customer service people can use to get info from our customers about our service etc. My question is how to store the questions/answers in the db where the questions are stored like so: boolean question1 if (false): string question2 (typically the ...

C#: How do you configure for a string[] to accept input of a whole string the way the console's main entry point accepts it broken up?

Exact duplicate: Split string containing command-line parameters into string[] in C# C#: How do you configure for a string[] to accept input of a whole string the way the console's main entry point accepts it broken up? When you execute a console application made in c#, it's main method accepts any other arguments typed into it ...

Cannot modify expression because it is not a variable

I'm trying to get an UserControl (which has a grid on it) on a Windows Form to resize. The below code is what I have in the Form. The behavior I'm getting is that the control is resized when I make it big. But it does not shrink. What am I doing wrong (or) What am I missing? private void AdjustGrid() { ZoomControl.L...

Pattern for unsaved changes

I'm developing a winforms app with lots of different forms and user controls. Is there a recommended pattern that I could implement that notifies the user that there are unsaved changes on the current form/control when the form/control is exiting and also when the app is closing? ...

Redmon redirect to a .NET Windows.Forms application

I have an interesting task: to write a program which captures input from the program called Redmon. It is basically a virtual printer which redirects the output to a program. I installed Redmon and created a winforms application to catch the output. But I'm stuck here. I checked what does my program receives and it is nothing on the par...

How to update Twitter status from c#?

I would like to update status on Twitter without using external libraries nor dll-s. I've found for example this solution: http://www.dreamincode.net/code/snippet2556.htm But it does not work and does not give any error. Could you please tell me how to update status programmatically from c#? When I catch error I get: 500 Internal Se...

WinForms vs GtkSharp with Mono

When developing with Mono for an app to be run on Windows and Mac OSX (and maybe Linux) which would you suggest, WinForms or GtkSharp for the GUI and why? Specific examples and success/horror stories would be much appreciated. ...

C# - Help with Customised DatagridView Cell Options

Hi, I am trying to customise a DataGridView cell to include a combobox and a text field. So far myCell class derives from DataGridViewTextBoxCell class. My class has a Combobox as a private member but I am not sure how I can render it. I am overriding the Pain method but I have no idea how to draw the combobox. I set its location ...

Why does TabStop stop working??

I have a project that uses a series of auto-generated user control instances. The user-control itself exists, but I populate a panel with a series of these user controls, one for each item in my collection. Each user control displays a ton of information, but only ONE text field is editable. All of the other fields have TabStop set to f...

What is the best way to convert between a Media.Matrix to a Drawing2D.Matrix

I have the need to convert from the WPF Media.Matrix to the Windows Forms Drawing2D.Matrix and so I did the following: public static System.Drawing.Drawing2D.Matrix ConvertToDrawing2DMatrix( Matrix matrix) { return new System.Drawing.Drawing2D.Matrix((float)matrix.M11, (float)mat...

Good book for Windows Mobile Development?

Can you recommend a good book for Windows Mobile development? I am using: Compact Framework 3.5 Windows Mobile 6 Professional SDK Windows Forms (WinForms) Thanks. ...

C#: Is there a way to return a reference to the selected Item in listview?

C#: Is there a way to return a reference to the selected Item in listview? Like in the selectedindexchanged, is there a way to return the item of the index that was selected? ...

How to handle tab order when doing progressive disclosure?

I'm converting a VB6 application to Winforms and in VB6 we frequently use a technique where certain textboxes are only made visible when specific values are entered in prior a textbox. The problem is that the decision to make the textbox visible is only made in the Validating event at which point the next control to gain focus has alrea...

What is the best way to draw "child" controls (such as buttons) within each item in a WinForms ListBox?

I'm writing a simple custom owner-drawn ListBox control and banging my head against the wall trying to figure out how to implement what seems like a straight-foward feature. My custom ListBox is supposed to work similarly to the "Add/Remove Programs" list in Windows XP. That is, it displays a list of items as usual, but when the user sel...

WinForm Controls behave differently on .Enabled = false

I have some controls on a WinForm namely: CheckedListBox, ListBox,ListView, TreeView, TextBox. On ControlName.Enabled = false; I have found following results: ListView and TextBox's BackColor get greyed. CheckedListBox, ListBox and,TreeView's BackColor does not get greyed. Why is this behavor? Is it a intented or Bug? and how to...

Determine state of keyboard in non-keyboard-event method call.

Hi In a textbox.TextChanged event I want to prevent some specific (processor intensive) functionality from executing if a key is still held down. E.g. while the user is deleting large regions of text by holding down the delete key I want to prevent the code from firing if the delete key is still held down. I looked into Control.Modifie...

How do you make a Winform track bar (slider) behave sensibly on a touch-screen monitor

What's the easiest way to modify a Winforms track bar so that when a user clicks on it the track bar jumps to the location of the mouse? By default the track bar moves to half way between it's current location and where the mouse was clicked. Update: I'm trying to do this so that I can use the track bar on a touch-screen. With a touch-...