winforms

Disposing a control by calling its own BeginInvoke()

Disposing a control from by calling its own BeginInvoke() is a good idea or bad idea? Or shall I use the parent control or something like that to accomplish this task? I'm using Invoke because I'm accessing the control form another thread. ...

listbox selected values (winforms)

Hi how to display seleted item values in multi selected listbox using winforms. can somebody give me a sample code snippet? thanks in advance ...

How do I enable paste in textbox with Ctrl+v

I have a normal textbox in my application. I can paste to it using my mouse but Ctrl+v does nothing. How do I fix that? ...

c# winforms: Getting the screenshot image that has to be behind a control

I have c# windows form which have several controls on it, part of the controls are located one on another. I want a function that will take for input a control from the form and will return the image that has to be behind the control. for ex: if the form has backgroundimage and contains a button on it - if I'll run this function I'll got...

Spellchecker for windows forms in .NET

I am looking for a third party component that could handle spellchecking for Windows forms (.Net 2.0 or .NET 3.5) I have the following requirement: 1) The component should be able to use Open office dictionary (Need to use a Swedish dic I think the OO is the best one) 2) Be able to underline in the UI while typing, like word. (Don’t w...

Is Visual Studio a Multiple or Single Document Interface?

In other words, if I want to write a winforms db application with an appearince like VS that has docked panels and also the ability to show/hide forms within some of those panels, how would I structure the interface? How would I have the ability to open several disparate forms at different times (with big data grids on them) while avoidi...

DataGridView SortCompare event doesn't fire

Using VS2008, C# and .NET 3.5 I am using databound DataGridView controls to display tabular data read from a web service. In several cases, there is a numeric column that needs to be sorted. I have tried a couple of different ways to get this to work, but the column still ends up sorting alphabetically (ie, 1, 10, 2, 3 instead of 1, 2...

Showing a Windows form on a secondary monitor?

I'm trying to set a Windows Form on secondary monitor, as follows: private void button1_Click(object sender, EventArgs e) { MatrixView n = new MatrixView(); Screen[] screens = Screen.AllScreens; setFormLocation(n, screens[1]); n.Show(); } private void setFormLocation(Form form, Screen scr...

Keydown event for entire application VB .Net

I want to make it so that no matter which control has focus, it will do my event. So that I dont have to write a keydown event for all 137 of my objects. Is this possible? Thanks ...

A different requirement for a Splash Screen in winforms app

Hi there. Ok, I know this has been asked a million times before (and people also start off their StackOverflow question in the very same way XD), but I would like to know how to achieve the following: The application first launches a login box If the login is successful, then the splash screen must show (on a separate thread). While t...

Avoiding the woes of Invoke/BeginInvoke in cross-thread WinForm event handling?

I'm still plagued by background threading in a WinForm UI. Why? Here are some of the issues: Obviously the most important issue, I can not modify a Control unless I'm executing on the same thread that created it. As you know, Invoke, BeginInvoke, etc are not available until after a Control is created. Even after RequiresInvoke return...

how can convert persian datettime to DateTime with c#?

i have one texbox in form that user insert persian DateTime i want convert persian date to Datetime for Save in sql thanx for answers ...

Removing manually added DataBindings

If a set of controls on a WinForm have had DataBindings created and attached at runtime, should they be removed when the Form is closed? Or will the GarbageCollecter deal with them? ...

Hosting ASP.NET within my application

I had a wild thought today. I've been discovering that my users like my web UIs more than my WinForms UIs...but there are good reasons to still write a 'smart client' application. Can I write my application UI in ASP.NET/MVC, host it inside my client exe, and locally access it using the IE control in my winforms app? Is there a lightwe...

C# WinForm with different Types ?

Hi! I have a form which encapsulates all the functionality, but works with a concrete Type T1. Now I want to create the same form with the difference, that it will use another Type T2. T1 and T2 don't inherit from anything, so I can't use inheritance. How could I do that without copying the whole code again and again? I was thinking ...

Is it possible to overload a thread using ISynchronizeInvoke.BeginInvoke()?

My problem is this: I have two threads, my UI thread, and a worker thread. My worker thread is running in a seperate class that gets instantiated by the form, which passes itself as an ISynchronizeInvoke to the worker class, which then uses Invoke on that interface to call it's events, which provide status updates to the UI for display....

How can merge a particular column header in DataGridView C#?

I would like to take a column header text for tow columns. How would you do this? Like this | FULL NAME | | first | last I show First & last in one column ...

winforms keydown event not working

How can i handle winforms keydown event? Actually i tried like this private void test_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { test2 tst2 = new test2(); tst2.Show(); } } but it is working only one time. What is the problem? ...

Synchronizing two BindingSources

I have a form with a DataGridView that opens a details form on a double click. When opening the second form I set it to use the same DataSet instance as the parent form. i now want to make sure the second form is pointing at the same DataRow as the parent as well. At first I just sent in the Position property of the parent form's Binding...

How can I lock Application.OpenForms?

Hi, I am writing a simple framework for testing WinForm apps, which is running in process. I am using Application.OpenForms to find the control I need to change in the current test step. However, I am sometimes getting errors that the collection was modified (probably by some other thread). How can I lock this collection, to make sure t...