winforms

How to restart my application if Windows Update forces a reboot?

At the office, when I leave for the night I very rarely log off or reboot. I simply lock my workstation and go home, leaving all my development tools exactly how I left them. If Windows-Update rolls through and reboots my machine in the middle of the night I'm only slightly peeved because when I log back in the next morning, any MS Off...

Buttons Enabled Property not Working Properly

Hi all, I am creating an Windows Application. I have two buttons. I have written the following code snippet. frmRb obj = new frmrb(); private void btnPd_Click(object sender, EventArgs e) { btnCancel.Enabled = true; obj.btnRtn.Enabled = true; } private void btnCancel_Click(object sender, Ev...

Why MDI parent form reset the Z indice of child forms when it is focused?

This is a WinForm application question in .net. It is about MDI form. I have an MDI form (ParentForm), in which I can create many instance forms of ChildForm. I create two ChildForm, named, cf1 and cf2 one by one. So, cf1 will have a Z index lower than cf2 and cf2 will be on top of cf1. Then I switch to some other form, meaning ParentF...

Drawing a line in Winforms

Hi, I am having trouble drawing a line within a group box in a simple windows form. here is my code: ==================================================================================== public partial class Form1 : Form { public Form1() { InitializeComponent(); } ...

Intercept modal dialog popup from another application

We have a third party Windows application that we feel is too complex for our users to use efficiently. The application manages a scanner that we're using to scan 3000 documents per day. The scanner application can be completely piloted using the keyboard. We are therefore in the process of writing a simple WinForms application that ha...

C# Win Forms Auto-Updating Controls

Hello! I have a datagridview and a combobox which get populated randomly with data. However, the new data is never displayed automatically. Someone mentioned the idea of invalidating the control to force the application to redraw it and thus iterate through the contents and populate the control with the new data. Does anyone know which ...

C# Iterate Over DataGridView & Change Row Color

Hello! I have a datagridview made up of multiple rows and columns. I want to iterate through each row and check the contents of a specific column. If that column contains the word "NO", I want to change the forecolor of the entire row to Red. Here is an attempt at some code so far but It's certainly not working, starting to wonder If I ...

UserControl event after Validated

I'm trying to implement this pattern in my WinForms application (I don't like it, but it was required by the customer): I edit the properties of an object in a DetailsControl (UserControl developed by us), and when the user tries to leave the control, then it's validated and saved If it's not valid, or an error occurs during save, the...

Please help me make this code thread safe

I've got a bit of a problem with making my data loading and filtering thread safe. The following code on my control's base class which handles all the data population through a BackgroundWorker. This tends to throw the error on "this.DataWorker.RunWorkerAsync()" saying that the BackgroundWorker is busy. /// <summary> /// Handles the po...

ListBox Focused Item

Hello, this is a WinForms question. In a ListBox with SelectionMode = MultiSimple, how can I get the currently focused item? Note, I don't want to get the SelectedItem or SelectedItems, but the item which currently have the dash lines around, something like ListView.FocusedItem. ...

How to expose and raise custom events for a vb.net winforms user control

Hello, Please read THIS post. I have the same problem as described in this post but I am trying to do in in VB.net rather than c#. I am pretty sure to do this I have to use a custom event. (I used a code conversion site to get to learn about custom events.) So in the IDE when I type the following: Public Custom Event AddRemoveAtt...

Save a custom cursor created by CreateIconIndirect to a cur file.

Hey, I've been trying to write code that loads a .png file, attaches hotspot information, and saves it to a .cur file. So far I have code to create a System.Windows.Forms.Cursor object, which I'll post below: Bitmap bmp = new Bitmap(source_image); IconInfo inf = new IconInfo(); GetIconInfo(bmp.GetHicon(), ref in...

Adding controls dynamically at design time vb.net

I have been developing some custom smart tags. I am using a DesignerActionMethodItem which gets me to a fired method in code. When I try to hit the controls.Add the control is added but it seems the designer is unaware of it. It is never serialized and it goes away when the form is refreshed in the designer. Any help would be greatly...

exposing methods as web service operations in winform

can't I expose my methods as webmethods in a winform and have other clients call them as webservice? Basicall I am trying to get my winform app to host a webservice without asp.net or iis. I am trying to get a ^%&^& blackberry to communicate with my winform app....tried for hours looking for some other way of getting the two to talk wit...

How to detect mouse wheel tilt?

To detect rotation of the mouse wheel in .NET/WinForms, I can override OnMouseWheel. Clicking can be detected by overriding OnMouseDown (it's just the Middle button). But how do I detect tilting of the wheel (tilt to the left/right for horizontal scrolling)? Neither OnMouseWheel, not OnMouseDown is being called when I tilt the mouse whee...

Checkbox not appearing in Winform GridView

Hi, I am binding a datagridview to a list of objects. One of its columns is a checkbox which is supposed to represent a bool property, the rest are comboboxes and textboxes. Everything is fine, but the checkbox cell is appearing as blank ! Also, when I assign the columntype, each type appears twice in the list e.g. DataGridViewCheckB...

WinForms WebBrowser Control - problems on redirect (C#)

I'm using a webbrowser control in a C# application. Everything works great until there is an automatic redirect on a website. When this happens, any call to webbrowser.DocumentText gives me this error: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002) at System.Windows....

Regarding Tabcontrol and forms

Hi, I have developed an application in windows forms.but now i was told to put the same in a tabbedpage.the problem I'm facing is how can i insert forms in a tabbed control .and if this is not possible,then what can i do .i need to navigate between the pages(or forms)and data shud be persistent while navigation. is there any way to inse...

How to determine the order of controls which have the same DockStyle?

I have 3 buttons Docked to left but I want to put them in specific order like button1,button3,button2 But when I start dock them in the mentioned order button3 goes before button1!!!?? How can I maintain my own order?? ...

Right Align DataGridView Column Header in Winforms

I have a column Name "Quote Price" in a DataGridView winforms control. I can right align a column with no spaces such as "Unit" howerver I can't right align the column header with column Name called "Quote Price". I have attempted to use the TopRight, MiddleRight and bottomRight with no success. SelectedAdditionalCost.Columns["Quote Pri...