winforms

Visual Studio Unit Testing of Windows Forms

We're working on a project here in Visual Studio 2008. We're using the built-in testing suite provided with it (the Microsoft.VisualStudio.TestTools.UnitTesting namespace). It turns out, that much to our chagrin, a great deal of complexity (and therefore errors) have wound up coded into our UI layer. While our unit tests do a decent j...

Use of Print Preview in .Net Winforms

I am writing c# code in .Net 2008 Winforms. I created a print preview window to create a report. It works fine I can preview the report and then print it. The only problem is it is not as flexible as the Office Print preview. The users cannot chose a printer other that the default printer and they cannot limit the print to certain pages...

MouseMove event too slow for painting

I'm using C# WinForms to create a level builder for my XNA game. I have a tile grid that you can paint with a Pencil tool, like in MSPaint. The problem is that when you drag the mouse fast(ish) to paint a line tiles get skipped. I've tried using one approach i saw on Google saying to spawn a thread to do the painting, but that didn't se...

Uninstalling a Windows app installed by a nonexistent user.

We have a .Net Winforms app running on XP machines that are not connected to the internet. We install and update this app by distributing a CD with a .MSI installer file. Users uninstall the old app from the Add or Remove Programs control panel and install the new app from CD. A while ago we required users to log in under individual acc...

What is the most common design patterns for any windows forms application?

I am asking about that as I am going to develop a client side application using c# to display stock data and make some user-interaction, so give me links for best tutorials you read before ...

How to get a specific cell in a DataGridView on selection changed

With a listbox, I have the following code to extract the item selected: private void inventoryList_SelectedIndexChanged(object sender, EventArgs e) { String s = inventoryList.SelectedItem.ToString(); s = s.Substring(0, s.IndexOf(':')); bookDetailTable.Rows.Clear(); ... more code .....

Best UI Framework for WinForms?

Can someone suggest a good UI framework for WinForms development? What I'm looking for is something that is fairly mature (=bug-free), renders well and quickly, and does not bloat my program with 10Mb assemblies. ...

How to move carret position to end of current word?

I'm using a webbrowser control. How can I move the insert position for an execCommand to the end of the word, that is currently selected? Example: | <- current carret position Som|eword -> move -> Someword| -> execCommand executes after current word What I want to do is insert a line without braking the word. What happens now is: ...

Best way to keep GUI updated when the underlying SQL view data changes?

Let's say you have a form with a component that displays data from a view on an SQL server. The component would be something like a ListView or DataGrid - basically something that can display the data in a 2D grid format. Another application changes the data that the SQL view describes, and does this regularly but at undefined intervals....

Can a form tell if there are any modal windows open?

How, being inside the main form of my WinForm app can I tell if there are any modal windows/dialogs open that belong to the main form? ...

How do I get the value (not check or unchecked) of a checkboxlist

I'm working on a winform app and am interating through a checkboxlist to see what's checked. If it's checked, i need to know what it's value member or value property is because I assigned it when I bound the checkbox list. How can I get that? Here's what I have now: for (int i = 0; i < clbIncludes.Items.Count; i++) ...

C# How do I check a selected item in a listbox using code?

I have a listbox with checkboxes, how do I check the checkbox of the selecteditem? Thanks ...

When I move through a list box, why do my checked items become unchecked?

The code below moves the selected item in the listbox downwards to the next item in the listbox, but it unchecks the selected item if it was checked. How can I prevent this? private void buttonMoveDown_Click(object sender, EventArgs e) { int iIndex = checkedListBox1.SelectedIndex; if (iIndex == -1) { return; } moveL...

How do I display tick marks on a Progress Bar?

I'm downloading a collection of files, and I'd like to display progress in a progress bar. It's simple to display overall progress by setting the maximum value of the progress bar to the total size of all the files, and by setting the current position to the size downloaded so far. What I'd like to do is separate the progress bar into s...

How to make text in a WinForms TextBox unselectable without disabling it?

Hi, Is it possible to make the text in a TextBox unselectable without disabling the TextBox? It's a RichTextBox and I need it's formatting and selection features. I can't disable it because I want to handle MouseMove and MouseDown events. So far I've thought about disabling the Text box and putting a panel on top of it which will deleg...

How to interact with an application programmatically

I am likely to be working on a few projects soon where I will need to take data from a file and input that data programmatically into another third-party (not my own) application. One problem: I have no idea how to do this.I will need to enter data (like times on a time sheet, for exampls) Can anyone steer me in the right direction to a...

Convert Windows Forms application into Asp.net

I am asking about the best tool that you used before to convert a c# windows forms application into asp.net? I already googled about this topic and found alot of tools but I want someone to recommend the best one based on his usage. ...

Ribbon UI Control for WinForms

Is there a Ribbon UI Control available in VS 2008? Will it be available if i have office 2007 installed on the development and deployment machines? EDIT: I would imagine that Microsoft would include the Ribbon UI control in VS 2008 as this is the way the UI of office is going to be moving forward also for the sake of consistency in Wi...

Redirect console output to textbox in separate program C#

I'm developing an Windows Forms application that requires me to call a separate program to perform a task. The program is a console application and I need to redirect standard output from the console to a TextBox in my program. I have no problem executing the program from my application, but I don't know how to redirect the output to...

How can I profile the performance of a .NET app already deployed to a customer?

I have several customers where my WinForms app does not perform as well as at other customers. I use JetBrain's dotTrace here in the office, but that does not help me find bottlenecks on the machines of our customers. How can I profile the performance of a .NET app already deployed to a customer? Are there any profiling tools with a redi...