winforms

How to send a mouse click event to a hidden window?

Recognising that a bit of interop may be required, how do I send a mouse click event to a window that is currently not being displayed? I have an application that is running as a service and fiddling about with hidden windows and needs to send a mouse click event to one of them, even though it can't actually display the window. The norm...

ObjectListView cast exception (for hit testing)

I am using Grammarian's ObjectListView. I changed my old listviews to that, but all I do is to fill in items. But when the app starts up and my mouse is over the listview, it immediately throws an exception for: System.InvalidCastException was unhandled Message="Unable to cast object of type 'System.Windows.Forms.ListViewItem' to type...

Creating grid in form to represent bit data (C#, Windows Forms)

I'm experimenting with C# using Visual Studio 2010 Beta 2. What I'd like to do is display data in a similar format as Windows Defragmenter does, i.e. in a grid consisting of many small rectangular elements. These elements should be turned off and on depending on data (i.e. having different colours) and customizable in number of elements ...

Task dialog button control?

I am trying to add a task dialog-style button control to my .NET application (C#). It is labeled "Custom Button" in the screenshot below. What is the name of this control for .NET, or how can I get it in my .NET form? I need compatibility with XP (and other non-Vista, non-7 OS's). I do not need to create the entire dialog. I just ...

C# - Update a subitem within a listview

I am working on an application where users enter information that is then added to a listview. That works great. The only problem is, the application connects to a web site that updates the "Points" field in that listview for each account. I am not sure how I can update a single subitem within a listview. Here is an example screensho...

how do i check if a printer is installed and ready using C#?

Hi, How do i programmatically check if a printer is installed or not (and if there is one, how do i check if it is on and ready to use?) in C# using .NET 3.5 and Visual Studio 2008? Thanks in advance, ...

Unable to bind crystal report designed for vb5 to winforms in c#2005.

I am able to open and see crystl reports designed for VB5 on crystal report in VS 2005. The database in use is Ms Access 2003; Error reported while trying to bind the old .rpt files to winforms. value cannot be null parameter name : path1 Please help me in how to fix this problem. Thank you ...

Selecting a printer in .Net

I have a win forms app that needs to allow the user to select a printer from the list of installed printers on the PC. Is there a built in dialog or do i have to write a custom dialog ? ...

Working with listbox in winforms (c#)

Hi, How can i add 10 items to listbox dynamically to a listbox and after that I want to show the selected item value in click event of list box. I tried like this for(int i=1;i<10 ;i++) { mylistbox.Items.Add(i.ToString()); } in click event handler MessageBox.Show(mylistbox.SelectedValue.ToString()); it is showing error. Whats th...

Auto size the controls in winform

Hi, I've a winform and I placed a listbox in that form. When I maximize the winform the size of the list box remains same. But I dont want like this. I want to adjust the size automatically. Is there any default property for this? Thank you, Nagu ...

C# - Detect reason for form closing

How can I detect how a windows form is being closed? For example, how do I find out whether the user has clicked on a button which closes the form or if the user clicks on the "X" in the upper-right? Thank you. Update: Forgot to mention that the button calls the Application.Exit() method. ...

Visual Studio IDE error

When i am going to run my project i am getting this error"F:\TestProjects\CallDll\CallDll\bin\Debug\CallDll.exe" is missing.Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to ponint at the correct location for the target assembly Can any one tell me the solution ...

how to implement undo operation in datagridview

Hi, I have created one application in c#.net.Using this application we can update datagridview,now i need to implement undo in it plz give me some ideas. private void button29_Click(object sender, EventArgs e) { Datatable dt; dt.RejectChanges(); } using above code i can do undo before updating. but i...

Using winforms default exception handler with WPF apps

For simple 'internal use only' apps, Winforms has a useful default exception handler, which allows an 'ignore', and tells you what the exception was. WPF apps don't seem to get this nice exception handling - you always have to exit the application. Obviously I can write my own default exception handler for WPF, but is there a simple ...

GUI as a finite state machine

To implement application's GUI I would like to have all the logic to go from one form to another centralized. This GUI manager will behave as a finite state machine. Although I think I have seen this kind of implementation somewhere, I can't find a design pattern that matches with this kind of solution. A form will look like this: publ...

How to generate a winform application with delphi and .Net respectively?

I need to make a choice between the two languages,both of which are new to me. I want to choose the simpler one. Also,please mention about the setups needed to run the programme. ...

How do I make an object's variable name editable in the designer?

I've written a custom control which mimics the appearance of a table header. The columns it draws are given by a collection of objects with a Text string property and a Width int property. Both have Browsable, Category, DefaultValue and Description attributes added. In the designer, the collection is editable and the user can set the ...

Open file read-only

In a C# WinForms app, I am using System.IO.Diagnostics.Process.Start(fileName) to open files. The type of file can be .doc, .docx, .xls, .xlsx, .csv, .pdf, or .txt. Is there any way to force these files to be opened read-only? ...

how to display data comming from pipe on GUI form in C #

I have made a small server and client application connected via named pipe. I am able to communicate between them in console application. Now i want that data to be displayed in text box on form. I am not able to display, once i assign the data it gets assigned but text box is not showing the new up dated value. Can any one help me to ...

DataGridView Event - which one to choose

I'm looking for an event that occurs right right after loading and after sorting. I have a piece of code that colors some of the Rows in a DataGridView control. But when I sort the style changes are lost. I need the right event to tap into to redo the coloration step after the load/sort events. Trying to right clean code ... so I was lo...