winforms

how do i prevent a form from being resized by the user?

i have a form that needs to be maximized in vb.net. i dont want the user to be able to change its size or move it around. ...

How do I stop items in a ContextMenuStrip from treating ampersands specially?

I have a ContextMenuStrip which displays items which can be named by the user; the user is allowed to give the items names containing ampersands. When the ContextMenuStrip is shown, the items' treat the ampersands as escape sequences, and underline the next character. I could double up all the ampersands before I set the items' Text me...

How to use System.Windows.Forms.WebBrowser in a web app?

I found a code of winform here: http://www.wincustomize.com/articles.aspx?aid=136426&c=1 And it works fine as a winform. But I want to run the code in a web app. I add the references of System.Windows.Forms and the Microsoft.mshtml.dll in the C:\Program Files\Microsoft.NET\Primary Interop Assemblies\ to my web app. I copy the Web...

WinForm ToolTip.SetToolTip is Hanging my application :(

Hi folks, I'm trying to set a ToolTip onto a control and it's hanging my application. I programatically add PictureBox's to a FlowLayoutPanel. Works great. I then pick out one of the PictureBoxes to set the ToolTip and .. boom! app hung :( If I set the ToolTip at the point where i first create each picturebox and add it to the flowlay...

Winforms Databinding object containing a List<T>

I'm having trouble with a situation that I know must be pretty common, so I'm hoping the solution is simple. I have an object that contains a List<> of objects. It also has some properties that reflect aggregate data on the objects in the List<> (actually a BindingList<> so I can bind to it). On my form, I have a DataGridView for the ...

Tutorials for DevExpress WinForms - Request Links Please

Hi Folks, Could anyone please recommend some decent tutorials covering the basics of using DevExpress Winforms on C# .NET ? I have googled a bit, but don't seem to find anything much. It's really much appreciated. ...

How do a make one form stay on top of another?

I have found the Form.TopMost property but it puts the form on top of everything, including stuff that isn't part of my app. I've got a suspicion that I'm missing something obvious here. (Is Form the proper bases class for a non modal dialog box?) ...

Can't leave focus on same cell in DataGridView in CellValueChanged handler (.NET)

In the event handler for CellValueChanged, for a certain condition, I want the focus to stay in the cell and clear its content. What's happening is focus (cursor) is in the next cell when the handler finishes its work. It needs to be in the same cell that caused the event. MyGrid.CellValueChanged -= new DataGridViewCellEventHandler(Cell...

How do I determine which monitor my .NET Windows Forms program is running on?

I have a C# Windows application that I want to ensure will show up on a second monitor if the user moves it to one. I need to save the main form's size, location and window state - which I've already handled - but I also need to know which screen it was on when the user closed the application. I'm using the Screen class to determine th...

How to prevent control from stealing focus?

We have a 3rd party control loaded in our C# WinForms app. When we call a method on this 3rd party ActiveX control, it asynchronously steals focus. For example: // This call causes 3rd party to spawn a thread and steal focus milliseconds later. foo3rdParty.DoSomething(); Is there a way to prevent a control from stealing focus? ...

Disable winforms refresh

Every time I change the enable disable property of the controls on my winform it repaints the whole form. I want to avoid the redundant repaints by only repainting when i have updated all of the controls. Is this possible? ...

MDI WinForm application and duplicate child form memory leak

This is a WinForm MDI application problem (.net framework 3.0). It will be described in C#. Sorry it is a bit long because I try to make things as clear as possible. I have a MDI application. At some point I find that one MDI child form is never released. There is a menu that creates the MDI child form and show it. When the MDI child fo...

Is it OK to change a winforms designer file?

I have created a class that is simply THIS Class UserControlBase Inherits UserControl End Class Then I changed the Inherits clause in each of my UserControls designer file to Inherits UserControlBase I know that generally you shouldn't manually mod the designer file. But in cases like this what else can you do? Is this O...

Can I get the instances of alive objects of a certain type in C#?

This is a C# 3.0 question. Can I use reflection or memory management classes provided by .net framework to count the total alive instances of a certain type in the memory? I can do the same thing using a memory profiler but that requires extra time to dump the memory and involves a third party software. What I want is only to monitor a ...

Populate list box from a table in vba

I am developing a vba form for employee database, in that there is a search criteria for userid and employees name with the userid should be displayed in a list box control which comes from a single table I need to populate a list box with value from a table according to a value in a text box which act as a search box (eg: userid) Plea...

How to draw on top of winforms controls with transparency?

I have an app with a bunch of controls in it and I want to place a set of cross hairs on top of it. My first attack used a PictureBox and ran into this problem. The solution that fellow proposes, seems a bit... verbose for what I need. Is there a simple way draw on top of my form? Note that I don't even need the drawing to be part of a ...

Modal Dialog from a Modal Dialog - both close when second is closed - why?

C# / .NET 3.5 / WinForms I've got a form that opens a modal dialog form which opens another modal dialog form. The inner dialog form has OK and Cancel buttons and its AcceptButton and CancelButton are set to them respectively. When I hit Enter or click OK in the inner dialog, the outer dialog closes as well. I can't see where I'm doi...

Winforms Textbox - Using Ctrl-Backspace to Delete Whole Word

I have a Winforms dialog that contains among other controls a TextBox that allows a single line of input. I would like to allow the user to be able to press Ctrl-Backspace to delete an entire word. This is not the default behaviour with the out-of-the-box TextBox; I get a rectangle character, rather than having the word deleted. I have...

Lazy load forms

I have a .NET CF program (running on a Smartphone) and I have written an options page for it. On the options page I have links to 6 other forms which contain the actual options. When the main form loads it creates the 6 subforms and stores them in a list ready to be launched. The issue with this is the initial creation time required to...

Unwanted wait cursor in WinForms app

I have an MDI WinForms app in which the MDI parent form has a ToolStrip, MenuStrip and StatusStrip. Whenever the mouse is moved over one of these controls the cursor changes to a 'wait' cursor (a arrow with an hourglass). This seems to be default behaviour in that there is no code to make this happen. The UseWaitCursor property of both t...