winforms

How to determine which control on form has focus?

Hi, I've read elsewhere on here that to capture "Enter" key stroke in a text box and use it as if pushing a button I should set the KeyPreview property of the form to true and check the value of KeyDown. I want to be able to use this functionality on several TextBox controls which each are associated with a different Button. My quest...

Showing a window with WPF, Winforms, and Dual monitors

I have a 2 monitors and a WinForm app that launches a WPF window. I want to get the screen that the WinForm is on, and show the WPF window on the same screen. How can I do this? ...

.NET Bootstrap without setup

I have a .NET WinForms application which needs to be run from CD. What I need to figure out is if user has required .NET version installed or install if necessary than run the application after installation. Any info I've found about bootstrapping involves setup and installation of the application. How can I do this if I don't install an...

How to display the same control on two different tabs?

I'm using VB.NET I need same control (ListBox) to be displayed on 2 different tabs. Is it mandatory to create 2 different ListBox instances? ...

Visual Studio WinForms designer does not instantiate object

I created a class derived from System.Windows.Forms.ContextMenuStrip class, not as a user control, just a plain .cs class with a constructor and one event handler. When I drag this class from the Toolbox onto the designer, it creates a private member for it and a couple of properties, but does not instantiate an object. Thus, at runtim...

Pitfalls of UI Control Librarys

I am building a c# winform app and the framework I inherited uses UI Controls from this library LumiSoft These seem fine but aged and buggy. The previous developer preferred them for the smaller sizes they allowed. I recently discovered these controls for free as well: DevExpress These are much newer and more full featured. My questio...

How to detect shift key pressed state when on mouse move.

I'm trying to show a zoomed in overlay on an image when mouse over and shift key pressed. The problem is that user might have pressed the shift key before even the window has focus, so KeyDown monitoring is not a solution. Is there a way to access modifier key states during mouse events? In Java for example the mouse event contains fla...

.Net winform button bug?

There seems to be a bug with .Net winform's button. If you left click and hold it on a winform button, then right click (while holding down your left click), then release your right click, then drag your button to outside of the button, then release your left click, it seems that your button will be "stucked" - it won't back to depressed...

How to keep dynamically populated datasets to stay with the program?

I have a winform application that uses some referenced web services to get data. The data returned is an array of objects that I loop through and add to a dataSet. When I call the service, it can often take 2 or 3 minutes to get all the data. If the user exits the program and comes back later, I don't want them to have to re-download ...

Create a semi-transparent cursor from an image

Is it possible to create a cursor from an image and have it be semi-transparent? I'm currently taking a custom image and overylaying the mouse cursor image. It would be great if I could make this semi-transparent, but not necessary. The sales guys love shiny. Currently doing something like this: Image cursorImage = customImage.GetThu...

Why is Me.components Nothing?

I have written a custom ErrorProvider which adds some functionality to the existing ErrorProvider (sets control BackColor, ErrorCount etc). This was working find but now for some reason it falls over on the constructor: _LoginErrorProvider = New ErrorLogErrorProvider(Me.components) The error is a NullReferenceException which is caused...

Ensure latest version with clickonce deployment

How could I ensure that all the clients will always be using the latest version of a winforms application (updates from a network place, suppose always connected) while deploying it with clickonce. Thanks. ...

How do I get a reference to the underlying object in a bound DataGridViewComboBoxCell?

I don't know if my mind is not working today or if this is actually harder than I think it should be. I've got a DataGridView with a DataGridViewComboBoxColumn bound to a generic IList of CustomObjects. Here's a rough code sample of how I setup the column. DataGridViewComboBoxColumn location = new DataGridViewComboBoxColumn() { N...

How can I set a form to have a transparent background

I am struggling to get my form to have a transparent background in vb.net Currently in the form New I set Me.SetStyle(ControlStyles.SupportsTransparentBackColor, true) But still the form shows up as having the default grey background Can anyone help?? EDIT: I need the controls on the form to be visible so I don't think setting th...

Prevent property change in databinding and force bound control to show current value

I have Public Overrides Property UID() As String Get Return mUID End Get Set(ByVal value As String) If Me.IsNew Then mUID = value End If OnPropertyChanged("UID") End Set End Property The class implements INotifyPropertyChanged and I...

Will you migrate your UI to using ribbons for Windows 7?

Soon Windows 7 will use ribbon as default interface in any Windows programs, like Paint or WordPad, leaving to back default toolbars and menus. Will you migrate your UI to using ribbons for Windows 7? ...

I get errors when viewing forms in the designer - how can i avoid this?

Some of my forms show errors when i load them in the designer. This is because in their constructors they use system settings loaded from a configuration file. When the form is loaded in the designer it uses some random path and unsurprisingly the config file isn't there. eg. The configuration file C:\Documents and Settings\Rory\Local...

How to prevent Just-In-Time Debugger showing when script error occurs in WebBrowser control

I use a WebBrowser control in my Winforms application. When I navigate to a Url that causes a JavaScript exception the Just-In-Time (JIT) debugger window shows up asking if you want to debug this exception: An Unhandled exception ('Object expected') occured in (application) This happens (in Release mode) even though I set the Scr...

Writing to a TextBox from another thread?

strong textI cannot figure out how to make a C# Windows Form application write to a textbox from a thread. For example in the Program.cs we have the standard main() that draws the form: static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); ...

Mouse button in ToolStripMenuItem

Hello! I have a context menu with a few items. One of the items has a submenu (or whatever it's called) with a few items (depends on what files it finds). What I want to do is when I left click one of the sub-items I want one thing to happen, and when I right click I want another thing to happen. My problem is that when I use the file...