winforms

How to Fix the Memory Leak in IE WebBrowser Control?

I am trying to embed a WebBrowser Control in a C# Winform Application. This sounds easy enough. However I discovered that the WebBrowser control eats up a lot of memory every time I call the Navigate method. The memory is never released. The memory usage grows and grows… Many people on the net having the exact same problem but I haven’t...

Controlling the rendering of a custom control

I want all labels inside a detail view to be bold. I created a simple custom label control that forces the font to be bold. This has the feeling of code smell to me. I'm not concerned with a developer being able to customize the custom control (baseDetailLabel). I just want to enforce an application wide standard for detail labels (They ...

Hyperlink in DataGridView - how to have text and links?

Is it possible to have a Windows Forms DataGridView in which one of the columns will display standard text with some words of it as clickable links? Here's what I'd like to do: whenever I get a certain regex pattern in the text, I want to make that match a hyperlink. Any idea on how to implement this? Thanks ...

How to prevent ListBox.SelectedIndexChanged event?

I am using a listbox in my C#2.0 windows forms application. The method to populate the list box is private void PopulateListBox(ListBox lb, ReportColumnList reportColumnList) { lb.DataSource = reportColumnList.ReportColumns; lb.DisplayMember = "ColumnName"; lb.ValueMember = "ColumnName"; } However...

Error occurs in Application after locking-unlocking Windows 2003.

Hi, We have a WinForms application running on .net framework 2.0 runtime. The application works absolutely fine on winXP. When we tried testing this app. on windows 2003 it throws a very unique clueless error. Here's the test case under which this error is produced. 1.) Application is started and user is using the app. 2.) The app. is...

How to increase the width of a scroll bar for DataGridView?

Is there way to increase the width of the scroll bars for a DataGridView ? ...

Dynamic Forms Control Properties

I'm creating a capture form on the fly based on a set of metadata held in a EAV type schema. My trouble is in load the data back to the control, and in particular a winforms combobox. Also using Entity Framework for the data that is bound to the control. Check is control exist, else create. for each mapped property set their values. ...

Winforms BringToBack Option?

In winforms there is a function "BringToFront" that moves a form to the top of the Z-Order. Is there a way to do the opposite--push a form to the back? ...

Binding an enum to a WinForms combo box, and then setting it.

Hi, a lot of people have answered the question of how to bind an enum to a combo box in WinForms. Its like this: comboBox1.DataSource = Enum.GetValues(typeof(MyEnum)); But that is pretty useless without being able to set the actual value to display. I have tried: comboBox1.SelectedItem = MyEnum.Something; // Does not work. SelectedI...

ZedGraph (.NET) - Having axis labels for actual values only

Using the ZedGraph control, say I am plotting data that has Y values of 13, 34, and 55. How do I set up my Y Axis so that the only text labels shown (and I guess that grid lines would be synchronised) are those for 13, 34 and 55? I don't want regularly spaced labels in the range of my data (say 0, 25, 50, 75, ..). Just labels at the ac...

How do I set a ListViewSubItem BackColor in Windows Mobile?

I'd like to change the BackgroundColor of a ListViewSubItem in a ListView in Windows Mobile. I'm using the Compact Framework ListView, whose ListViewItems only allow setting the BackColor on the entire row, which I don't want. I have two questions: Is this possible? If this is possible, I know I have to P/Invoke to get this to work (...

How to bind DataGridView with List<T> or BindingList<T>

I've done it one thousand of times and it works but now .... not :( Am I doing something wrong here because nothing is shown in grid ? namespace theGridIsNotWorking { using System; using System.Collections.Generic; using System.Windows.Forms; public partial class Form1 : Form { public Form1() { InitializeComponent(); ...

How can I use threads in C# to load several images from the web at once?

Hi all, I have a windows forms application in .NET 3.5. There's one form with 20 picture boxes. There's also an array with 20 image URL's. The goal is to loop through the array of URL's and load the images from the web into the picture boxes. I tried having a standard foreach loop and use the picture box LoadAsync() method, but it does...

How can I monitor the winforms TextBox.SelectionStart property for changes?

I have a multiline text box, and I'd like to display the user's current line number and column number in a label below the text box. It looks like I can get the line number and column number using the SelectionStart property, GetLineFromCharIndex method, and GetFirstCharIndexOfCurrentLine method. However, I can't see any event that gets ...

DataGridView Copy Paste (with style, backgorund color, ...)

I have a C# Windows Form Application with a DataGridView. Copy & Paste (ctrl-c after selecting the data in the datagrid and ctrl-v in Excel) is working almost fine. The problem is that the style (such as background color) is not being pasted in Excel, only the cell values. Do I need to change a property somewhere on my datagridview or...

OpenNetCF FTP class multithreading question

Currently, I have something like: public partial class Form1 : Form { delegate void StringDelegate(string value); private FTP m_ftp; public Form1() { InitializeComponent(); } private void connect_Click(object sender, EventArgs e) { OnResponse("Connecting"); m_ftp = new FTP(server.Text); m_ftp.ResponseReceived += new FTPResponseHandle...

Windows Forms Controls in a ScrollableControl and Events

I have noticed that the Click event, or other control behaviour, is not always fired when a control contained in a ScrollableControl (Panel, etc) is clicked on. If the control being clicked doesn't have the focus and is only partially visible it is scrolled into view. This is what I am expecting, however the Click event doesn't get fire...

Custom Designer class for a .NET Windows Form issue

Hello guys, I have implemented a custom designer class which inherits from DocumentDesigner. The standard Form class in the .NET Framework uses the FormDocumentDesigner class (also inheriting from DocumentDesigner) but since this class is internal it is not possible to inherit from it and customize its behavior I copied the logic in thi...

Can I invoke routed WPF command from WinForm control

In windows form I have a reference to WPF wrapper which wraps WinForm control. I would like to handle events in WinForm control as usual and then invoke apropriate routed commands from WPF wrapper. Can it be done? ...

How to disable ellipsis of cell texts in a WindowsForms DataGridView?

I have a DataGridView in readonly mode in a .NET 3.5 (Visual Studio 2008) WinForms application. The cells' width is very small. Some of the cells contain a short number. Now, even with a small font, sometimes the number is shown with an ellipsis. For example "8..." instead of "88". Is there a way to let the text flow over the next cell...