winforms

.NET C# - Form versus Designer code files for Event Wiring

I was just curious how others work with this kind of WinForm code in C#. Lets say I have a Form lets call it Form1. And I have a DataGridView called dgvMain. Where do you put the code: this.dgvMain.CellEndEdit += new DataGridViewCellEventHandler(dgvMain_CellEndEdit); Do you put it in the Form1 code or the Form1 designer code? Shoul...

.NET WinForms 2.0: How to have a shared imagelist?

i want have to have a single imageList used by multiple forms in a project. That is to say multiple controls use the same image list. Note: Ideally multiple projects in a single solution will use the same image list - but i don't want to ask too much of Microsoft at once. Ideally multiple projects in multiple solutions will use the same...

Hosting Windows Shell Explorer in my WPF App

Is it possible to embed the Windows Explorer file/folder browser view in a WPF or a WinForms window? I basically want to host the file/folder browser as part of my app window. I don't want to re-implement what the shell provides, especially the shell extensions such as TortoiseSVN. ...

Turn off calling tabPage_Enter method in C#

When I switch tabs with the following code tabControl1.SelectTab("MyNextTab"); It calls the tabPage_Enter for the tab it is switching from and the tab it is switching to. I want it to be called for the tab it is switching to, but not the tab it is switching from. How would I turn this off. I do know when it happens so if there was a c...

Maintain scroll position of treeview

How can I maintain the scroll position of a treeview control in .NET application? For example, I have a treeview control and go through a process of adding various nodes to it tacking them on to the bottom. During this process, I can scroll through the treeview and view different nodes. The problem is when the process completes, the tree...

Crystal Reports vs. WinForms issue

I have a WinForms app (written in VB.NET if that detail matters) which has an embedded Crystal Report for tracking application utilization (let's call it utr310.rpt). Our reporting guy made a minor tweak to the report that has been in production and I'm trying to test with it (let's call the new one utr311.rpt) except that I'm getting th...

DataGridView SelectLine color to none?

The grid display all information correctly, In the event dataGridView1cellFormatting I change the backcolor depending of the object under the line value. This works too. The last event that I have on my grid is the dataGridView1_CellPainting that check if it's the header to add an icon. Everything is fine until I try to take out the col...

how to get rid of checkedlistbox selection highlighting effect

When an item is clicked in the checkedlistbox, it gets highlighted. How can I prevent this highlighting effect? I can hook into the SelectedIndexChanged event and clear the selection, but the highlighting still happens and you see a blip. In fact, if you hold down the mouse click, never releasing it after you clicked on the checkbox ar...

SEHException from applications on a mapped share

Background We run all our windows forms applications from a windows share (UNC) mapped locally to user's W drive. We've had connection issues the past few days and are receiving System.Runtime.InteropServices.SEHException's from somewhat random places in our programs after they have been running from several minutes to several hours. ...

C# Problem setting label text on another form

Hi, I am a very new C# programmer and I am trying to make a kiosk application more accessible by increasing the size of fonts. No problem on the main form. I'm having a problem replacing messageboxes (for which I believe there is no way to increase the font size) with small forms with the same message. This is where I'm running into t...

How do I determine which monitor my winform is in?

I have been up and down this site and found a lot of info on the Screen class and how to count the number of monitors and such but how do I determine which montitor a form is currently in? ...

Question System.ExecutionEngineException while loading WPF window from Windows Form...

I found some rather strange behavior... Here is how to replicate the problem: Create a WPF Application Project. Remove the StartupUri from the App.xaml file. Add a Startup Event Handler to the App with signature "private void Application_Startup(object sender, StartupEventArgs e)" Now, add a Form to the project (right click and select...

DataGridView custom sort not on DataMember (Databound Grid)

I have a custom DataGridView column that uses an embedded control that pops up a search window for the value of that column. The important thing is that the databound column is a numeric ID, but the custom column cells display a text description. How do I get the column to sort on the text description rather than the numeric ID? I...

Porting VB.NET Winforms Application to C#

Are there any 'good' resources for porting a VB.NET winforms application to C#? I'm sure there are is software that just translates the code, but I'm looking to refactor the code at the same time. Keeping it in its current form is problematic, since it uses some of the 'bad design' practices that VB.NET allows, and would further compli...

C# Winforms: How to get a reference to Form1 design time

I have a form that has a public property public bool cancelSearch = false; I also have a class which is sitting in my bll (business logic layer), in this class I have a method, and in this method I have a loop. I would like to know how can I get the method to recognise the form (this custom class and form1 are in the same namespace). ...

What are your experiences with NetAdvantage or DXperience?

I'm looking into both of them, and while I have been quite pleased with NetAdvantage at my previous employer, I find the price point (plus testimonials like at http://stackoverflow.com/questions/37921/what-is-the-best-winform-ui-component-set) to make me hesitate and consider DXExperience. That said, I'm wondering: What your experie...

Set value of bound field to NULL using DataGridViewComboBoxColumn in DataGridView

I have a DataGridViewComboBoxColumn in a DataGridView that's based on a lookup table. The ValueMember and DisplayMember fields are bound to string columns in the DataTable. All rows have a value for both fields - except for a special record where the value field is deliberately set to NULL. However, when I choose this record an empty s...

How do I populate a ListView in virtual mode asynchronously?

I'd like to display records from our database in a listview - but retrieves can take a long time. I can use RetrieveVirtualItem to tell me when a new ListViewItem is needed, add a dummy item, and start a retrieve; but what do I do with the record when the database returns it? I can't update the ListView's Items collection while the Lis...

Help me with that CrossThread?

This code is executed by many way. When it's executed by the form button it works (the button start a thread and in the loop it call this method = it works). BUT it doesn't work when I have a call to that method from my BackgroundWorker in the form. With the following code: private void resizeThreadSafe(int width, int height) { if...

Resetting a winform's elements to initialized state (C#/.Net)

I'm building a winform in C# with various elements in a panel that start out either invisible, disabled, or set to null (labels, combo boxes, grids, etc.). As the user goes through and makes choices, these elements are populated, selected, etc. The idea is to upload files, read them, and process entries to a database. Once the processi...