winforms

capture console.writeline from windows application

Hi, I have an external dll written in c#. I studied from the dll's documentations that this tool writes its debug messages to the console using console.writeline. I 'd like to execute this tool from windows appliaction. when I do that, I loosing those debug messages since windows applications does not have a console... is there a way ...

Good DataGridView tutorial

I'm writing a windows C# application which I wish to use data grid views, but unable to find a good tutorial on to take complete control of the datagrid eg: add columns, add data etc. ...

Gantt Chart Controls on Windows Forms

We are evaluating options for a Gantt chart control (on Windows Forms) as opposed developing one on our own. What are the various Gantt Chart controls you have had experience with? Pros and cons? Is it a viable idea to develop such a control from scratch (given that the control is not the primary product in this case)? Update: Just bri...

Performance comparison of Winforms and WPF

Since XAML gets compiled, there should be no difference in execution of code like this. Winforms (code like): Form formPeter = new Form(); Textbox textbox = new Textbox(); Label l1 = new Label1(); Xaml does not get parsed at runtime, as I thought... :-) But what about rendering/execution of big forms with lot of controls? Which tech...

Can I detect errors while using a .Net WebBrowser control?

I have an .Net Froms application that displays web pages through a WebBrowser control. Is there anyway that I can detect if the control shows a 'Page not found' or 'Cannot display webpage' error? There doesn't seem to be any error event handlers. ...

listview item cut style in .NET?

Hi All, How do I achieve the equivalent of the LVIS_CUT style for a listview item? It looks like it's not exposed by the framework? Should I P/Invoke? Edit: LVIS_CUT is a Win32 style that affects the look of the item: It grays the item image. You can see it in action in Windows Explorer: Select a file and type Ctrl+X. TIA. ...

Errors in Windows Forms controls in designer view

On occasion, I get the following error in design mode of some user controls in Visual Studio 2008: The file 'UserControl.vb' does not support code parsing or generation because it is not contained within a project that supports code. It doesn't happen on a consistent basis, but it happens enough to be annoying. Are there any...

Winforms + MDI children

In WinForms, is there a way to specify initial starting locations of MDI Child windows in a somewhat intelligent manner? I can apply a manual position, or have it center parent, but neither of these options take much thought into existing windows. I'd like to know if there is built in way to do a "smart arrangement", or if I need to im...

How to create a form on its own thread and keep it open throughout application lifetime

I am creating a little testing component and am running into a problem Basically the component is a decorator on a class that controls all access to the database, it creates a form with a two buttons on it: "Simulate Lost Connection" and "Reconnect". Press the button, and instead of letting function calls pass through the wrapper start...

Show messagebox over Save dialog in C#

SaveFileDialog savefileDialog1 = new SaveFileDialog(); DialogResult result = savefileDialog1.ShowDialog(); switch(result == DialogResult.OK) case true: //do something case false: MessageBox.Show("are you sure?","",MessageBoxButtons.YesNo,MessageBoxIcon.Question); How to show the messagebox over the savedialog b...

convert a keycode to the relevant display character

In a C# Windows.Forms project I have a control that does not supply the KeyPressed event (It’s a COM control – ESRI map). It only supplies the KeyUp and KeyDown events, containing the KeyEventArgs structure. How can I convert the information in KeyEventArgs to a displayable Unicode character, taking the current active keyboard layout ...

How do I programmatically check an item in a checkedlistbox in c#

I have a checkedlistbox and I want to automatically tick one of the items in it. The CheckedItems collection doesn't allow you to add things to it. Any suggestions? ...

How to use Data Annotation Validators in Winforms?

I like the Validation Application Block from the Enterprise Library :-) Now i would like to use the DataAnnotations in Winforms, as we use asp.net Dynamic Data as well. So that we have common technologies over the whole company. And also the Data Annotations should be easier to use. How can I do something similiar in Winforms like Steph...

Server-side paging with DevExpress without XPO

Is there any (relatively) easy way to implement server-side paging using DevExpress controls (either Win- or Web-ones) without using an XPO data source? By server-side paging I mean control retrieving only the records it needs to display from the database, not the whole table. ...

How to make Enter on a TextBox act as TAB button

Hello, I've several textboxes. I would like to make the Enter button act as Tab. So that when I will be in one textbox, pressing Enter will move me to the next one. Could you please tell me how to implement this approach without adding any code inside textbox class (no override and so on if possible)? Question is about C# and .NET ...

Get Component's Parent Form

I have a non-visual component which manages other visual controls. I need to have a reference to the form that the component is operating on, but i don't know how to get it. I am unsure of adding a constructor with the parent specified as control, as i want the component to work by just being dropped into the designer. The other tho...

How do I listen for scrolling in a ListView?

The ListView doesn't seem to support the Scroll event. I need to call a function whenever the list is scrolled; how would I go about that? ...

Looking for a .NET "text" editor control.

My boss is looking for a .NET text control to build a custom editor on. Here’s what we need it to do: Supports embedded tables, with easily editing (like Word tables). Supports different text styles (font, size, color, background, etc). Ability to programmatically set styles, both on first load, and as file is edited. Supports key/mous...

How to block the UI thread from another thread or force a form to run within the UI thread

A requirement for my application is if it looses database connectivity then it must pop up a big modal "No Connection. Try again later" dialog blocking all user interaction until such time that connectivity is regained. I achieve this by at the start of the application starting an instance of a DeviceMonitor class. This class creates ...

MDI Pros & Cons

I have inherited a application framework from the previous developer where I now work. This framework utilizes multiple parent/child relationships. In many instances parent/parent/child occur. I asked why he WASN'T using MDI and he stated that years ago, when he had started, MDI had major shortcomings concerning the previously stated ...