winforms

WinForms Application in MonoDevelop

I just installed the new MonoDevelop Windows beta, but when trying to create a C# windows application the only option was GTK#. Since Mono supports WinForms, why is this not an option in MonoDevelop. I would like to not have the GTK# dependency in my applications. ...

SQL statement with datetimepicker

This should hopefully be a simple one. When using a date time picker in a windows form, I want an SQL statement to be carried out, like so: string sql = "SELECT * FROM Jobs WHERE JobDate = '" + dtpJobDate.Text + "'"; Unfortunately, this doesn't actually provide any results because the JobDate field is stored as a DateTime value. I'd l...

Getting the handle of window in C#

I'm trying to do some P/Invoke stuff and need the handle of the current window. I found this thread here But it appears that only works in WPF. Is there a winForms equivalent? ...

c#: Window Forms: Retrieve child control values from unactivated tab.

I have a winform with a tab control. On the default tab I have a 'go' button tied to a function that retrieves the values from textboxes on the second tab(default values). The values come up as "" if I don't first look at the 2nd tab which i'm guessing causes the textboxes to be poulated with the default values. How do I make the form ...

How to redraw Node in TreeView (WinForms)

I need to implement own TreeView with blinked TreeNode. My prototype is: public class BlinkTreeView : TreeView { private int blinkInterval; private bool blinkState; [Category("Behavior"), Browsable(true)] public Icon BlinkIcon { get; set; } [Category("Behavior"), Browsable(true)] p...

DataGridView with run-time columns

I'm using C#, Windows Forms, .NET 3.5 SP1 I have a DataGridView with a lot of columns that I don't know about until run-time (i.e. I don't know I need a Foo column until run-time). To get data into and out of the cells, I'm thinking about the following architecture. Am I on the right track, or am I missing something easier? public in...

File corrupted?

Hi All, I have a form, MainForm, which was working just fine and dandy until earlier this morning. I made some code modifications to a different form and when I went to run the application, I received an error in MainForm (error is irrelevant). I went into MainForm to see what the problem was and was horrified at what I saw... ALL MY ...

Wait for file to be freed by process

How do I wait for the File to be Free so that ss.Save() can overwrite it with a new one. If I run this twice close together(ish) I get a generic GDI+ error. ///<summary> /// Grabs a screen shot of the App and saves it to the C drive in jpg ///</summary> private static String GetDesktopImage(DevExpress.XtraEditors.XtraFo...

Prevent DataGridView selecting a row when sorted if none was previously selected

I have a datagridview that may or may not have rows selected when the user sorts it by clicking on a column header. If there are rows selected there isn't a problem, but if there are 0 selected rows then the sort selects a row automatically (the selection is consistant but I'm not wure what the criteria is). How can I prevent this beha...

How to implement SSO (Single Sign On) for a WinForms app and SQL Server

We have a WinForms application that uses SQL server to store its data. To authenticate the application users, we are using SQL Server to do the authentication. The user must have a username/password that exists on the database server to be able to log in. So far so good. Now one of our customers wants us to implement single sign on. T...

Line break issue with label control in Windows Forms

Say I have a label control in Winforms and I want to do some thing like: 1) One 2) Two How do I to that? If I add a "\n" to the string it does not seem to work. Is the label control inherently single line? ...

Detecting the startup path of a C# windows form application

Hello everyone. I want to know the application startup path for C# 2.0 windows form application. One way is Application.StartupPath. Is there another way to find the application startup path? ...

How Do I scroll to a string in a Rich Text Box

I ahve a RTB with sufficent text that scrolling is needed user enters a string and I highlight all occurrences using a combination of Find and Select which is great but now I want the ability for a user to press Next and the next higlighted instance should be visible say 2at /3rd of the bounding rectangle ( I would even settle for at th...

How to add Windows 7 Jump Lists to a application

I want to add custom jump list entries to my application in Windows 7. The menus I am referring to are the following. Pin a application to the taskbar. Now right click on the application. Some applications like windows media player etc. have custom options that you can run. How do I go about adding these to my application. ...

Replace '\' with '/' in a String C# WinForm App

Hello everyone. Can anyone please suggest a way to replace back-slash '\' with slash '/' in a string. Basically the string is a path. I have tried using Replace() method of string, but its not working. Thanks ...

C# Windows Forms, Controls on tabs

Hi, I have a tabcontrol on my form, on each tab I have a control, each of these controls are similar i.e. they each have a table and a couple buttons and each control is set to Dock Fill When I view them contols in design view something weird is happening, the first tab that is viewable has it controls placed as you would expect and al...

How to programmatically control the CPU utilization by an C# winform application

Is there any way we can cap the maximum allowed CPU utilization by a windows application developed in C# .NET apart from the thread mentioned at posting http://stackoverflow.com/questions/261089/controlling-cpu-utilization ...

How does the .net framework nest forms in classes. (vb.net).

If I look at some classes in the framework, using reflector, I can see that forms and user controls are made private and nested into a parent class. For instance, I have a control which makes use of pop-up form that is specific to that control. At the moment, I make the pop-up form friend accessible. If I wanted to do it the framework w...

UI Testing Tool?

Looking for a tool to UI testing of a Windows (.NET WinForms) application. The idea is that the analysts will record the tests via some UI and it will be able to be played back over and over again. Commercial tools are fine but bonus points for free ones. ...

Automatic proportionate resizing of Windows Form Components?

I have a Windows Forms form in C#. It is just like a regular Windows GUI application. However I am facing problems making the different components on the form resize themselves according to the window size. I mean I do not exactly know which property of the component is to be changed. I have a tabPage in the form. The tabPage contains ...