winforms

Close button in tabControl

hi all, is there anyone can tell me how to add close button in each tab in using tabControl in C#? i plan to use button pic for replacing [x] in my tab.. thank you ...

imagelist with label, why does it keep shrinking images

I am using an imagelist with a label control, basically doing custom rolleover affect. However, if I use an imagelist and try and write the image to the label it keeps shrinking the image to 16x16, even when the image in the list is actually 21 high by 65 wide, why is this and how can I stop it, basically display image at its default si...

Upload a File from My Desktop to a Secured File Server (FTP) via Winform

I have a Winform, i need to give a user a change to upload a file from the desktop to a remote file server. The user just browse and locate the file then click upload button. Anything else happens behind the seen. I'm using C# Windows Application. Please note that the file server requires authentication before uploading or downloading. ...

How to make autocomplete on a TextBox show suggestions when empty

I am using the AutoComplete properties on a textbox (actually a ToolStripTextBox). This is working fine except it doesn't show until I type at lease one character. How do I make it so the suggestions are shown even if the textbox is empty? Mode = Suggest Source = CustomSource Source set progamatically and limited to 10 items Alternat...

KeyPreview (KeyUp) handler passing KeyUp to forms created in the method

Issue Weird problem. We've got two forms: the main application window and a settings form. The main form has its KeyPreview set to true, and a method attached to its KeyUp event. This is so that the settings window can be opened with a key shortcut (ctrl-m): private void MyShortcuts(object sender, KeyEventArgs e) { if (e.Control &&...

.net winforms GUI pattern for blotter

I have to design a .Net winforms GUI which has around 10 tabs - each of which display a blotter grid. The rows correspond to records in cache and the cache data changes frequently. The amount of data is large and the requirement is that only those grid cells should be updated for which the corresponding data has changed in the cache. Is...

C# Why isn't it possible to set GUI specific actions in the winform constructor?

I was wondering why it isn't possible to set some properties in the constructor of a winform. For example, I have an Expandable splitter (devcomponents library) and when i set the property Expanded to false, in the constructor nothing happens, but when I put the same code in the form load event, it works like expected. I am putting this ...

Triggering a "Click" event without user input

I have a Windows Forms Link Label, "Refresh", that refreshes the display. In another part of my code, part of a separate windows form, I have a dialog that changes the data loaded into the display in the first place. After executing this other code, pressing "Refresh" updates the data correctly. Is there a simple way for the dialog men...

Requested registry access not allowed

When running my Windows Forms application on Windows 7 I get the following exception message: Requested registry access is not allowed. at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) at Microsoft.Win32.RegistryKey.Ope...

How to remove icon space after null SmallImageList property of ListView

The problem is, once the SmallImageList is set to imgList1, it never "releases" the icon spacing, even when the SmallImageList is set to null. The item is always indented the same whether there is an icon or not. any solution? ...

Is there a converter from WinForms to WPF?

I understand that the tecnhologies are vastly different, but I have a largish project that I would like to convert to WPF, and if there was a converter that could get it even 50% there, and show areas that it couldn't convert, then it would be helpful. ...

Adding controls dynamically on a windows form

I am trying to add a bunch of controls dynamically in rows and columns in a windows form. For ex: if i have 20 controls and i need to create 3 columns and n rows. How to achieve this. Any suggestions will be appreciated. Thanks N ...

Is it possible to hit a WinForms "Button" from an Excel spreadsheet (VBA)?

Hi, The traders are lazy and they don't want to switch applications to hit buttons. When they hit the button in Excel, it should be the same as hitting another button in my WinForms app (which pops up a dialog box). Doable? ...

How to ensure a Windows Form is "fully" closed?

I have a form in a Windows form application that I want to display on top of a main form, close it, and then immediately show a dialog box using MessageBox.Show(). But the first form is still showing when the message box is shown, and it does not disappear until I click OK on the message box. I tried waiting to show the message box in ...

Property Grid Color Picker control not allowing custom color editing

When using the Property Grid and exposing a color property from an object you get this kind of interface for color selection: There are tabs for System and Web, those are fine, but the Custom tab (shown) which seems to be a subset of the standard windows color picker, seems to be hobbled. How do you create custom colors? How do you ge...

Conditionally compiling UI components & logic

Hello there, I'm looking at producing a few versions of my app with restricted functionality, and I'd like to leave out the code that is not necessary in simpler versions. Being a WinForms app, the UI will have to change for each version - not displaying the restricted controls. I made an attempt to annotate parts of the auto generate...

Custom user controls - how to add Code Collection Editor of type Dictionary<int, Color>

Hey there, I am fairly familiar with creating simple custom controls, but I haven't had this instance come up before, I wish to give design time changeability support to a "Colors" dictionary which applies a series of gradients to a custom control panel. Although using a simple public Dictionary<int, Color> ProgressValueColors does in ...

how to save/restore a form and controls between program runs?

I have a complex form to allow the user to configure my app. What's the best way to save the form state & reload when the program next runs. I mean text he has entered in list boxes, the selected item of combo/list/radio, whether a checkbox is cheeked, etc ...

Why does the TreeView control collapse all the children nodes?

When I programmatically collapse a TreeView node like this: treeView1.Nodes[0].Collapse(), all of the children nodes collapse under it, which is really annoying. This doesn't happen when you manually click on the node to collapse it and the children nodes remember their collapsed/expanded state. How do I prevent this from happening? ...

Avoid pressing . (period) key to move to next field in DateTime picker control

Hi all In datetime picker control the user has to press .(period) to move to different fields (like day, month year) I want to override this behaviour by allowing the user to enter date without entering .(period) Is there any to achieve this programmatically in C# winforms? Thanks in advance. ...