winforms

C#: Preloading forms on a separate thread.

I have some forms that takes a bit of time to open because they currently get some stuff from a database in their Load event handler. Is it possible to somehow load the forms in a separate thread and show them to the user when that is done? If loading them so that the Load event handler is fired is not possible, maybe having a IPreload...

C#: How to prevent Invoke from failing

I have a UserControl with something that does some background work. When thing has a completed event, which the user control is subscribed to. Since the event is raised in a separate thread and the event handler does some updating of the user control I start the event handler with this: private void ProcessProcessCompleted(object sender...

Splitter leaving trail in winforms datagridview custom editing control

I've created a custom column for the datagridview. The editing control consists of a user control with a multline textbox and button placed on it. This all works fine unless I size a column left or a row up. The part of the splitter over the background of the user control is fine, but the part over the textbox or button leaves a trail b...

Is there a quicker way?

I have a combobox that passes along values in text, but they can have different meanings, e.g.: 8:30 - 9:30 => slot 1 10:30 - 11:30 => slot 2 12:30 - 13:30 => slot 3 or 8:30 - 11:30 => slots 1 and 2. 10:30 - 13:30 => slots 2 and 3 Basically, I want to pass these values into a database. So if the number of hours required is two, t...

Strange Property Override in DataGridViewTextBoxCell.

If you look at the DataGridViewTextBoxCell property, ValueType, in reflector, you can see it overrides a property from DataGridViewCell. The strange thing is, is that the overriden property is readonly, but the property in the parent class is read and write. I can only presume that the property has been shadowed and reflector doesn't ....

C# WINForm avoid two message box

Hi All I have a GUI program with one "Exit" button. When clicking this button, it would call the Application.Exit() to close this program. Before closing the program, it also calls a confirm message box. I also implement the Closing Event for this GUI main form. In this event, it also calls a confirm message box, then calls the Applicat...

Automated testing of DotNetBar Controls

We have been asked to test a .NET Application developed using DevComponents DotNetBar controls using automated testing tools. This is a WinForms application using Ribbon, TabStrip etc. controls from the DotNetBar suite. I tried automating this application using Microsoft UI Automation Library and the White Framework, but no success. Ha...

any way to hide percent sign in DataGridView ?

Using .net 2.0 . I want to display a column in a DataGridView as a percentage value, but without the percent sign. example : 1) say data in data source is 0.1234 2) using a DataGridView column format string of "P2" makes the grid show this value as "12.34 %". What I want to see is : "12.34", i.e. the original value multiplied by 100...

how to update a textbox in a form from textbox in other form

i need some ideas ...

C# Winforms, Distinct double click from expanding the tree node in TreeView

I need to distinct the action in BeforeExpand event of TreeView. The problem is that the DoubleClick event is lunched after BeforeExpand event. When user double clicks the tree node the DoubleClick event is fired - which is ok, but the node is expanded/collapsed. I'd like to limit that the user needs to click '+' to expand the node and...

winforms setup file enhancement

Hi i've created a setup file using c# winforms. Now i'm going to do some changes in the code and want to rebuild the same setup file. Every thing going fine. But when i try to install the new setup file it is asking application alreay exist. I dont want to do like this. If alreay exist it should ask me like update, remove, reinstall li...

Rights-based security model (Winforms, EF)

We are developing a winforms CRM application with the use of ADO Entity Framework. For the security model we looked at role-based security but find it to sensitive to change. Our requirements are very complex since we need to define permission on a criteria. An example would be that "advisor" could only be modified by user X if the relat...

Finding physical path in C# .net

@"F:\LEAFPRODUCT\Bin\Service.exe" This is the physical path of Service.exe, let me know is there any other alternate way or any general way to find the physical path of WrmService.exe in window application. In a web application we can use Server.MapPath like that. Here I need to reduce path means label1.Text = AssemblyName.GetAssembl...

Show or hide a title bar on demand

Hi, I want to add an option to my windows form application (written in vb.net) that will give the user the option to hide the menu bar and the title bar. I can do the menu but i'm not sure what the best way is to hide the title. I could just change the FormBorderStyle to none, but is that the best way of doing it? Cheers Luke ...

.NET WinForms - Programmatically End Current Edit - DataGridView

How can you programmatically end the current cell edit without losing the change? I have my DataGridView set to EditOnEnter mode. I tried EndEdit() on the grid but this backs out the current edit. ...

How do I insert text into textbox from line in file in multiple textboxes?

I am trying to do something but I haven't found anything on google since I don't know how to word it to get the right results. I have a Form with 9 TextBox controls, and a PlainText file with 9 lines of text. I want to click a button which will then add the first line of text from the text file into the first TextBox, then the second l...

Binding Entities to a Windows DataGridView

I have an EF source that I'm binding to a DataGridView. The binding is happening programatically. However, the sorting is not working. So I decided to mess with some code and create an Extension Method, but it seems like its still not working. public static class BindingListEntityExtension { public static BindingList<T> ToBindingLi...

DataGridView navigation on Enter/Return

I'm trying to use the Enter key to move to the next (non-read-only) column in a DataGridView. Under normal circumstances, I handle the KeyDown event and everything works great. However, when I'm editing a field, the Enter key always completes the edit and then moves to the next row. Weirdly enough, I'm getting the following sequence of...

How can I dock my winform application with another application.

Hi guys I am trying to do my winform application dock and follow another application, like IE or word. My full plan is run the program underground and then this specific application is running, my winform will maximize and dock, will follow if moved, minimize if this application is minimized. Can you guys show me some ideas about how t...

.NET - WinForm Textboxes - Focus and SelectedText

Whenever I set focus to a Textbox in WinForms (.NET 3.5) the entire text is selected. Does not matter if I have MultiLine set to true or false. Seems to be the exact reverse of what this user is seeing: http://stackoverflow.com/questions/97459/automatically-select-all-text-on-focus-in-winforms-textbox I have tried to do: private vo...