winforms

How can I handle ComboBox selected index changing?

Hello, I have a ComboBox that have a list of manufacturers. When a user selects a manufacturer, a grid below is populated with data for the chosen manufacturer. That data can be modified. The user has to press the Save button after all changes are done. But the user can forget to press Save and select another manufacturer from the Comb...

Removing and re-inserting ListView columns (.NET)

I'd like to be able to remove and re-insert columns in a last-removed-first-reinserted fashion, but the ListViewItem.SubItems[] values get messed up if more than 1 column is removed. For example, A B C D A0 B0 C0 D0 If I remove B, then B0 disappears, as expected. When I re-insert B, B0 re-appears in the correct location, bet...

Creating a Pop-Up Calendar in a VSTO Excel Project

I'm trying to use the System.Windows.Forms.MonthCalendar control within a VSTO Excel workbook. I want the MonthCalendar to pop up when I click a button in the ribbon, but so far I can't get the control to display at all. Private Sub DeliveryDateFromCalendarButton_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Rib...

Silverlight Object Display in Winform Application

Is this possible? If so, how? ...

How replace 2 files ?

Hi, i have this code snippet private List<string> FolderOne(string Folder) { string filena; DirectoryInfo dir = new DirectoryInfo(Folder); FileInfo[] files = dir.GetFiles("*.mp3", SearchOption.AllDirectories); List<string> str = new List<string>(); foreach (FileInfo file in files) ...

What references does Visual Studio add when I accidentally click Add New Winform?

Strangely enough, this is not on The Google. And I could really use a list so I know which ones I need to remove. ...

Control.Invoke with input Parameters

From what I've found in C#, the Control.Invoke method requires that you use a delegate with no input parameters. Is there any way around this? I would like to invoke a method to update the UI from another thread and pass to string parameters to it. ...

Create a List View with Header sections

I would like to create a 'New Document' dialog similar to the Office 2007 style (see pic). I am having trouble with the list shown on the left. I have tried using a ListView control but I can't figure out how to display the header sections that scroll with the list (e.g. 'Template Categories' and 'Microsoft Office Online' What is my b...

UserControl as an interface, but visible in the Designer

So we have a C# WinForms project with a Form that contains a bazillion UserControls. Each UserControl naturally exposes all the UserControl methods, properties, etc. in addition to its own specific members. I've been thinking that one way to reduce the complexity of dealing with these UserControls is to access them through an interface...

Linq to Entities Filtering an Entity Dynamic/Strongly Typed

I am binding a Winforms Grid to an entity. (For reasons I won't go into here it must be bound to the entity, not the result a query) The code is as follows: grid.DataSource = myEntities.entityName.Where("it.field = " & field) It works, but it obviously isn't strongly typed. Is there a way to define the Where clause of an entity usin...

How do I access the value of bound control on a non-displayed tab for validation?

I have created a dialog which contains 3 tabs. Controls on Tabs 1 & 2 have validation using the Validating() event. The user will mainly be working on Tabs 1 & 3, never displaying Tab 2 unless necessary. All controls on Tabs 1 & 2 are bound to a BindingSource object. From my observation, it appears that the bound controls are not ini...

How to implement security component in Windows Forms?

Coming from ASP.NET into WindowsForms app development I was expecting to see the similar controls to work with. To my surprise, I didn't see any security controls (login, user management, etc.) Am I missing something, or I'd have to implement my own security for the application (role based security, user management, etc.)? The applica...

Handling multiple forms in C# app

I'm trying to modify a C# WinForms application that uses multiple forms. At startup, a login window will be shown. If the user logs in with a correct user name and password combo a form with three different tabs will be shown as a sort of administrators view. If no password or user name is supplied, a much simplified GUI will be shown. I...

IExtenderProvider and WinForms designer file

C# 3.5 Winforms... So I’ve recently discovered the IExtenderProvider and how it can be used to extend controls with additional properties. In a prototype project that I setup i put a break point on the ‘set’ method for my extendee property and as the form loads I could see the ‘set’ method executing for every control on the form; which...

DataGridView Scroll event (and ScrollEventType.EndScroll)

When handing the DataGridView.Scroll event, you can check whether it was the end of the scroll (when dragging the scroll bar with the mouse, this is presumably when the mouse button is released). The problem is that this never seems to happen. e.Type is never ScrollEventType.EndScroll What's wrong with this? How can I do something only...

WinForms window created on worker thread not receiving all expected messages

I am playing back audio in C# using the waveOut functions with the callback method where messages are sent back to a window handle. I am creating a Windows Form with an overidden WndProc function to listen for the MM_WOM_DONE messages. result = WaveInterop.waveOutOpen(out hWaveOut, devNumber, waveStream.WaveFormat, waveOutWindow.Handle...

Enum or Dict? Which would help me here?

I have a winform data entry and retrieval program called CaseNotes. This has a form that that fill in. On the form there are multiple dropdown,checkbox controls that I are data-bound to a tblCNMaintItem. The structure of that table is --> ItemID | CategoryID | ItemDescription | OrderID | IsActive There is a seperate Category table t...

extend a user control

Hello guys, I have a question about extending a custom control which inherits from UserControl. public partial class Item : UserControl { public Item () { InitializeComponent(); } } and I would like to make a control which inherits from Item sg like that public partial class ItemExtended : Item { publ...

Is there a way to make a UserControl unfocussable?

Is there a way to make a UserControl unfocussable? EDIT: So SetStyle(ControlStyles.Selectable, false) is the way to go. But still there is difference to Control. If you inherit form Control the initial control does not lose focus. But after clicking on your control that is derived from UserControl and ControlStyles.Selectable is ap...

Editbox portion of ComboBox gets selected automatically

Hello, I have a small problem that has been annoying me for some hours. In my WinForms (.NET 3.5) application I create some ComboBoxes (DropDownStyle = DropDown) in a TableLayoutPanel at runtime and fill it with strings. The ComboBoxes are configured to resize automatically (Anchor = Left | Right). The problem is that whenever the Com...