winforms

Gridview link button click event - Windows application

How to handle click event of the linkbutton in gridview in vb.net (windows application ) Thanks ...

Difference between .Owner property and ShowDialog(IWin32Window owner) ?

I presume a winform's owner can be set explicitly via the .Owner property OR by passing the owner in the overloaded method ShowDialog(IWin32Window owner) I am unable to understand why these methods exhibit different behavior when working with MDI forms. I have created an MDIParent and an MDIChild. I also have a simple winform MyDialo...

Formatting text for a combobox, C#

I have three values I need to align in a dropdown box. How can I do this? I've been trying this: String.Format("{0,-30}{1,-15}{2,-10}{3,-8}", new object[] { cusJob, service, username, time }); But that leaves it uneven because it's not a monospaced font. I don't really want to use a monospaced font and I've seen applications align it b...

Extend System.Windows.Forms.ComboBox

I would like to extend the System.Windows.Forms.ComboBox control with a ReadOnly property, which would display the selected item’s text (similar to a label) when ReadOnly = true. (I do not like the disabled look achieved by setting Enabled=false) How do I do this in winforms? It was really simple in ASP.NET where all I had to do was ove...

gridview control capable of displaying rich text in WinForms

Hi, I'm looking for a WinForms control that would allow me to display data in a table like manner but with some rich content such as different font colors, images. I do not need data-binding etc., just a "table of RichTextBox controls". I suppose it wouldn't be difficult to build such a control myself, but I thought I'd ask first... Th...

What's the best way to detect an internet connection using .NET?

I have a Windows Forms application. When the user imports a license for my application I'd like to "phone home" (hit an aspx page on the web) and register the license information. The problem is that the user may not have an internet connection working at that moment. I'd like to test this first. What's the best way to detect if the use...

WinForms Load vs. Shown events

Hopefully I'm just missing something obvious, but I'm trying to get my head around the differences between the Load and the Shown events in WinForms. Traditionally I've only used Load (or actually OnLoad, since I think it's cleaner to override a method than to rely on the designer to hook up an event on yourself), since that is availabl...

How to Display Vector Graphics (SVG) in a Winforms Application?

Does anyone know of a way (preferably a control) to display vector graphics (preferably SVG) in a Winforms app? Im guessing that this would be easy to do with WPF, but I would prefer not to have to migrate the project. ...

Develop multilingual windows application C#

I am asking about the common techniques which are used in c# to support multilingual interface in windows forms ...

How to unit test winforms applications

Thanks to ASP.NET MVC framework, it became possible to unit test web applications. But how do you unit test windows forms applications? ...

Making winform switch tabs

I'm making a winform in C# using Visual Studio 2008. Currently, I have a tabcontrol, containing 2 tabs. In the first the, there is a button. When I click it, I must be taken to the second tab. Problem is, I don't know how. I've tried debugging, looking into al kinds of Properties and messing around with them, but I found nothing that h...

ListBox with overriden CreateParams doesn't raise item events

Hi, I've created a custom ListBox like in here. Thing is it doesn't raise any of the item specific events like DrawItem and SelectedIndexChanged. Any idea why? Thanks. ...

winforms control size limit

I am using a Panel's paint event to display a really long diagram. I've run into the problem of .net controls size (height and width) are silently limited to a signed 16 bit integer (32,767). I'm assuming this is an underlying win32 limitation. Is there a way to get around this limitation and have larger controls? ...

Shortest code to spawn a modal dialog box from a thread

Say I have a thread that keeps running in the background to figure if a URL is accessible. If the URL is not accessible, the application need to show a modal dialog box. Things cannot go on if the URL is down. If I simply do a MessageBox.show from inside the thread, that message box will not be modal. ShowDialog won't work either. ...

Best way to implement keyboard shortcuts in winforms?

I'm looking for a best way to implement common windows keyboard shortcuts (for example Ctrl-F, Ctrl-N) in my winforms app in C#. The app has a main form which hosts many child forms (one at a time). What I'd like to do is this: when a user hits Ctrl-F I'd like to show custom search form. The search form would depend on the current open...

RightToLeft property in Form in C# (updated)

Dear all; Ok, what if I want to move the form title, icon and close,Help buttons from left side to right side (change the layout) I moved the form controls manually to keep background image but now I want to change the form title .. //------------------------------------------------------------------------------ When I set rightToLef...

Visual Studio: How to view "Advanced" properties in the Properties window?

i need to see the ClientRectangle of a form as i'm designing it. This particular property is tagged as "Advanced", and by default is hidden from the Properties window: [EditorBrowsable(EditorBrowsableState.Advanced), ...] public Rectangle ClientRectangle If the ClientRectangle property i want to look at is out, then i guess i can sett...

Unhandled, non-ui thread, exceptions in Windows Forms

Short of inserting a try/catch block in each worker thread method, is there a way to deal with unhandled, non-ui thread, exceptions in Windows Forms? Thread.GetDomain().UnhandledException works great for catching the error, but by then it's too late to do anything about it (besides log it). After control passes out of your UnhandledExce...

C#: Move Controls From Form to tabPage in VS Form Designer

I decided to change a utility I'm working on to use a tabpage. When I tried to drag various controls from the form to a tab page on top of the form, it made copies of the control, giving it a different name. It's easy enough to just remake the form on top of the tab or just edit the source code in the designer to have everything be add...

Can ReportViewer render a hyperlink with a relative path?

I have created a local report on a datasource that has a field named "RelativePath". When my WinForms app renders the report, it exports files to the location specified in the RelativePath field. In the report builder, I set Navigation|Hyperlink action|Jump to URL to "=Fields!RelativePath.Value" and set the report's EnableHyperlink prope...