winforms

.NET App which has initial WindowState == Minimized, but shows up in the taskmgr->applications tab on Vista/Windows7 but NOT on WinXP

I have a windows form application in which the Form1 object's initial WindowState == Minimized. This works as desired in the sense that the application does indeed start minimized etc. However, the application shows up in the applications tab of the taskmgr which is undesirable. I've only personally been able to reproduce this on Vist...

Detecting mousewheel over non-focused window?

My goal is to make a floating toolbar (as its own C# application), and when the user uses the scrollwheel over me I want to change the buttons that are visible. Sounds easy enough, should just be a matter of this one-liner: MouseWheel += new MouseEventHandler(Form1_MouseWheel); The problem I am having is that the mouse wheel handler i...

Compile an ASP.Net in a WinForms application

I'm trying to develop an agent/client that will listen to HTTP requests on a given port, and serve a simple ASP.Net page. To that end, I'm using the HttpListener and ApplicationHost classes. I've added a simple page to my project (mypage.aspx). When it contained all the code in the single file, all worked well (tested it by adding <% Res...

How do I Iterate controls in a windows form app?

SO this is a dumb question. I have added a bunch of textboxes to an options dialog in an app I've written. They are named textbox1 - textbox12. Is there a way to access the the names programmatically? I'd just like to iterate over them in a for loop. Right now I am accessing each one individually (shudders!). I know this is the wrong way...

CryptographicException: Couldn't acquire crypto service provider context.

Reposting from http://www.mentalis.org/forum/thread.qpx/971 because I need an answer. I hope you guys can help me out. The component in question is Org.Mentalis.SecurityServices.dll. Hey all. I'm having troubles. CryptographicException: Couldn't acquire crypto service provider context. StackTrace: at Org.Mentalis.SecurityServices....

WinForms - Prevent the Changing of a ComboBox - DropDownList mode

In Winforms what is proper way to keep a user from changing the value of a DropDown? I want to prompt the user to say that there are unsaved changes. If the user decides to not throw away these changes I want to cancel the combobox changing. Any ideas on how to do this? I though I had seen a e.Cancel option before. But maybe not on Syst...

DataGridView not showing properites of objects which implement ICustomTypeDescriptor

I'm displaying a list of objects in a DataGridView. Everything was working fine. Columns were automagicaly added to the DataGridView based on the properties of the objects. Now I changed the class I'm displaying in the grid to implement ICustomTypeDescriptor. But now the grid now no longer shows any columns or rows when I set it's DataS...

how do i prevent multiple instances of added rows in a listview?

Hi. Here's my code: List<ListViewItem> itemsToMove = new List<ListViewItem>(); foreach (ListViewItem item in lvScanRepository.SelectedItems) { itemsToMove.Add(item); } foreach (ListViewItem item in itemsToMove) { if (!lvBatch.Items.Contains(item)) { lvScanRepository.Items.Remove(item); lvBatch.Items.Add(item...

C#: Form templating system

I want to create a form templating system in a c# winforms application. Admins could create and manage forms whereas users could fill them out (Like in Lotus Notes or Access). This needs to be in a user control. I've been playing with solutions such as XSL and possibly dynamically creating HTML, but these seem pretty ghetto. Is there a m...

C# Winforms Begin/EndInvoke and IAsyncResult

Can anyone give me an example scenario where Asynchronous Callback should be used in an Winforms Database application? And also an example scenario where Asynchronous Callback must be used in an Winforms database application? ...

WinForms Control for Textfile converting like in excel or open office?

Hi, for a Windows application I need to read in fixed block files which need to be splitted in fields. I would like to this like in excel or openoffice where I have a preview of the file and can graphically define where the line should be splitted. Does anyone know some control for .net which supports this, or any sample code where th...

C# Winform ProgressBar and BackgroundWorker

I have a problem like this : I have a Form named MainForm. I have a long operation to be taken place on this form. While this long operation is going on, I need to show another from named ProgressForm on top of the MainForm. ProgressForm contains a progress bar. Which needs to be updated while the long operation is taking place. Af...

C# WebClient - View source question

Hello, I'm using a C# WebClient to post login details to a page and read the all the results. The page I am trying to load includes flash (which, in the browser, translates into HTML). I'm guessing it's flash to avoid being picked up by search engines??? The flash I am interested in is just text (not an image/video) etc and when I "V...

FlowLayoutPanel autowrapping doesn't work with autosize

Hi! .NET Framework / C# / Windows Forms I'd like the FlowLayoutPanel to automatically adjust its width or height depending on number of controls inside of it. It also should change the number of columns/rows if there is not enough space (wrap its content). The problem is that if I set autosize then the flowlayoutpanel doesn't wrap cont...

Why is StateImageIndex on TreeNode limted to a max value of 14?

Can someone here please explain to me why the StateImageIndex on TreeNode is limited to a maximum value of 14? It doesn't make any sense to me at all. ...

What should I return from LINQ To SQL for DataGridViews

I have a WinForm App that uses multiple DataGridViews. The DGV's used to be bound to DataTables in the old SProc's DAL. As I was converting the SProcs to LINQ I originally was following suite but I am wondering if that is the "best" way. This is a sample of what I am doing. internal static CmoDataContext context = new CmoData...

C# ListView: ListViewItem offset possible?

I was wondering... I have a WinForms System.Windows.Forms.ListView with a bunch of ListViewItems that I'm drawing using the View.List style. Each ListViewItem has a "SmallIcon" that I fetch from the ListView's SmallImageList. My problem is that the icons are showing too close to the border on the left. I've tried to change the bounds an...

Application design advice

I’m looking for some advice for an application I currently developing. I’ll try to keep this as brief as possible so if additional info is need just let me know. I’m developing an Winforms based event tracking system using VB.Net (VS 2008 Pro). The application collects data via serial bar code scanners and stores this data within a MS...

How should I set an image index of an ImageListBox item in a databinding scenario?

I have a Document object that looks like this: public class Document { public Title { get; set; } public Extension { get; set; } public byte[] Data { get; set; } } The Extension is "pdf", "doc", "docx" and the like. This document is used for storing documents in a database (it's actually a DevExpress XPO object). The prob...

How to retrieve combobox selection in a windows form

All, I have a simple windows form with a combobox and a 'OK' button. After clicking the 'OK' button, I want to retrieve the selected combobox value. The GetUserForm has 2 controls: combobox named cmbUser, with a list of 2 values button named btnOK Nothing has been done to the GetUserForm class itself. The class contains: public par...