winforms

TextBox autocomplete and default buttons

Hello, I have a .NET TextBox with AutoComplete feature on the form. The form has also AcceptButton and CancelButton defined. If I try to commit a suggestion with Enter key or close drop down with Esc, my form closes. How can I prevent this behavior? ...

FixedToolWindow appears as floating bar when ShowInTaskbar is false - how can I stop this?

I'm using a WinForm configured as a FixedToolWindow. I've set ShowInTaskbar to be False - I'm using a NotifyIcon to manage restoring the window, once it's been minimized. When I minimize the window, it becomes a bar in the bottom left corner of the primary screen - a window title bar, I'm guessing. I can move it and if I then restore ...

How to add more than 65,535 columns in a data grid view in C# windows application?

Or is there any better suited 3rd party control for this purpose? ...

Class Template in C++/CLI

Hello, I formed class template that represent two dimensional array : template<class T> class Array2D { protected: public: T *data; const unsigned rows, cols, size; Array2D(unsigned r, unsigned c) : rows(r), cols(c), size(r*c) { data = new T[size]; } ~Array2D() { delete data; } void...

How to use DOS font in WinForms application

I want to use in my WinForms application a font used in .net console application. What font do I need to use? Lucida Console is not the font that is being used in .NET Console application as I see it. So Lucida Console is not the one I want. ...

How to raise an event between two different forms ( of the same program)

I have a MDI form that will open a logon form so the user can be authenticated when the user hits the logon button and is properly authenticated i wanted to trigger an event that the parent form could pick up and change some variables ((authenticated = true) for example) I understand how to do this in something like a textbox or a cost...

How to determine the disabled color for a given color in winforms?

Windows forms has the handy ControlPaint.DrawImageDisabled to paint a color image in a grayed-out, disabled state. Is there a way to determine, for a given color, what the disabled color would be (as if it were drawn by DrawImageDisabled)? ...

How to scroll down in a textbox by code in C#

I am using winforms, and I update a text box once in a while (showing messages). however, when the text reaches the end of the box it produces scrollbars and I don't know how to scroll down to the bottom. The only thing I see is ScrollToCaret, but Caret is at the beginning of the text. What is the command to scroll? ...

What WinForm Control To Bind List(Of T)?

I have been working on keeping things object oriented for my project. Currently, I'm using a .DLL which supplies all of the app's classes to the WinForms project acting as the presentation layer. My .DLL will, for example, return a SortableBindingList(Of T) to code in a form. The SortableBindingList(Of T) comes from here. Let's assume a...

Application startup flags in Windows Forms?

Is there a way for a Windows Forms application to detect if any flags have been added to the command/shortcut used to launch it? Like if I wanted to go "app.exe /flag", can I get the "/flag" somewhere programatically? ...

Can't find context menu in control collection

I have a form. This form has a user control. This user control has a panel and a context menu. The context menu is not attached to the panel. There are other controls that are dynamically created and added to this panel. One of those controls is a button. When you click this button, I set the contextmenustrip property to my context menu....

User Control Click - Windows Forms

Hello, I have a custom user control on my windows forms. This control has a few labels on it. I will be dynamically displaying an array of these controls on my form which will contain different bits of data. What I am trying to do is know which user control was selected when I click on it. This works when I click on an empty space o...

How to bind a ListBox to a property of type List on an object?

I have a form with a DataGridView showing a list of customers, and some text boxes below showing details of the customer selected in the grid. I have a Customer class and a CustomerList class of Customer objects, and a BindingSource with DataSource set to a CustomerList. The DataSource of the grid is this BindingSource. Binding the tex...

Protecting connection string from Man in the middle

In my winforms application i am hashing the connection string in local level. But here a couple of questions. After my app decrypts the connection string, the connection string info is sent in clear text? And since my app is installed locally the man in the middle could be ANY user? How can i protect the connection string, becides th...

Prevent events from firing multiple times from single action

How can I prevent the firing of multiple events of the same kind triggered by a single action? For example, I have a ListView containing some items. When I select or deselect all items, the SelectedIndexChanged event is fired once for each item. Rather, I would like to receive a single event indication the user's action (selection/desel...

VBA Code closes my separate .Net Winform App!?!?

The below code is the close routine of an Access App our BA wrote. When executed it is not only closing the Access App but my C# winform app as well, on the same computer. The Access app is named DME Referral and my winform app main process runs in the Task Manager as MATRIX.exe.(Yes I am programming the MATRIX...never allow a group of...

Why is only the first shown window focusable

Imagine the code below. Only the first window appears on the top, all of subsequent windows won't nor can they be programatically focused for some reason (they appear in the background). Any idea how to workaround this? BTW, static methods/properties are not allowed nor is any global property. [STAThread] static void Main() { ...

What is causing validation on my textbox?

I made a custom text box yesterday with its own validator: public partial class CustomTextBox : TextBox { ErrorProvider errorProvider; public CustomTextBox() { InitializeComponent(); errorProvider = new ErrorProvider(); errorProvider.DataSource = this; } protected overri...

Mysterious, ghost-like, impossible-to-find TreeNode text

So I have a TreeView that starts off empty. Sequence of events is as follows: Add a new root node. Code makes the label edit box pop up immediately, and I give it a name. Add a new subnode to that root node. Add a new root node, after the first one. The label edit box pops up, and I give it a name. The second root node takes on its n...

Winforms UI Thread Marshalling BusinessObject list being updated from background thread

Hi, Firstly I know that there are many question and solutions to correct thread marshalling from threads other than background threads. All the questions and solutions I have found have focused on scenarios where the list or business object itself raises an event that the Windows form can subscribe to and then correctly marshall the upd...