winforms

prevent the designer from calling a getter (VS 2008, WinForms)

hi, I have a simple UserControl containing a ComboBox which is empty at first. The setter for that CB adds items to it and the getter returns the selected item. When adding this UC to a Form, the designer automatically calls the getter for the CB which is empty. The method to fill up the CB with items is called later. I can think of one ...

Problem with virtual mouse click

Hi. I have a program that simulates mouse click. Code is something like this: [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo); private const int MOUSEEVENTF_LEFTDOWN =...

WinForms cursor hidden only on one Form

I have a C# application with 2 simultaneous visible forms, and I need to hide mouse cursor when it is over only on one of them. If I use Cursor.Hide() it applies the change for both of them. ...

WPF Applications Size Vs Winforms App Size

Does WPF compiled code is bigger or smaller than Winform compiled code? Does WPF generates more code behind that Winform does? I have a Winform App and I want to make a new version on WPF. Customers get the updates of this app by dowloading it. So my question is, If I make the application now on WPF just using the same screens how bigger...

Is there a way to remove Alt-character shortcuts from controls at runtime?

I have a dialog with a number of Alt-Letter shortcuts on labels for textboxes/etc. This dialog can present data in either an editable or a read-only mode. I've received a request to hide the underlines for the shortcuts if the dialog is in read only mode. Other than editing the label text at runtime (ugh) is there any way to remove th...

A good way in .NET Winforms to have user entered time frame?

Hi, Does anyone know of a good way to have a user enter an amount of time (hours and minutes) using winforms controls? At the moment I have two numeric up downs, one for time and one for minutes that I then parse to create a timespan. The only other idea I have is a text box that a user can enter a "00:00" time in, and validate the inp...

How to update the column of datagridview from the text contents of textbox in c# Windows form

I have a datagridview with contents from a table. In that I have a column for Remarks which will be 1-2 lines. When I click on the remarks column, I want to open another form that contains the text box. I have linked the text box with the table using the table adapter. Now when I close the form with the text box, I want to show that in t...

How can I make a hotkey trigger a WinForms button?

I have a button on a form to which I wish to assign a hot-key: namespace WebBrowser { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } int GetPixel(int x, int y) { Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppPArgb); Graphics grp = ...

Has song finished playing? (C# MCI)

Hi all I have an mp3 player that sends MCI commands to play pause/ff/rw/stop the audio files etc and the only thing i can't figure out how to do is send an MCI command to tell it to play the next song when the current one's finished playing. The songs are in a ListBox. I have no problems actually selecting the next song, I just need to...

Winforms-how do I keep window fully painted/responsive during a long running synchronous request is carried out?

Hi, Background - For a winforms 3.5 c# application, I would like to keep the main window fully painted/responsive during a long running synchronous request. For example if the user moves the window. Question - Is there a way to achive this WITHOUT having to setup a separate thread or backgroundworker process? (e.g. like a way to ca...

Winforms StatusStrip - why are there periods where it is blank when I'm updating it???

Hi, BACKGROUND: I have a WindowForms v3.5 application with a StatusStrip set to be used as a TooStripStatusLabel. I'm issues quite a lot of updates to it during a task that is running, however there are noticable periods where it is BLANK. There are no points when I am writing a blank to the status strip label either. QUESTION: An...

How to close a windows form and transfer control to an other form?

I have encountered a problem in my application. I have two forms, one that is loaded when my application is started that asks for a password and other is shown when the user logs in with correct password. How can I close the login form and have the user proceed to next form that is actual application? Currently I hide the login form, b...

C# timer won't tick

hi, i have a strange problem... I've been going out of my mind for the past couple of hours... the timer i put in my winform code (from the toolbar) won't tick... I have timers on a couple of forms in my program, they all work fine... I try to do exactly the same it this it won't tick... I select it, drag it on to a form, enable it, se...

How to show only border of winforms window when resizing?

I would like to disable displaying of the content of the window when resizing, is it possible? The problem is that when I'm resizing my window the controls redraw on correct positions but it doesn't look good because it's not done fluently. EDIT: I would like a code that would manage the following scenario: I click on the corner of ...

Winforms: Enabling Localization by default (enforcing a project/solution policy)

Is there an easy way to set the Localizable property to true for newly created usercontrols / forms? The scope of the setting should ideally be a solution or a project. In other words I want to say that this project/solution should be localizable, and then if I add a new form or control VS should automatically set the property to true....

Problem in creating different types of columns in a Winforms gridview

My windows form application has a grid view control with filename as a default column. User should create a column of following types Text, Number, Currency, Combo Box, Check Box, Radio Button ,Date time type (should display DateTimePicker control) and Hyper Link type. After that i want to pass all rows to next screen for fu...

Disable JavaScript error in webbrowser control

Hi, I am developing a windows application with a webbrowser control that navigates to a sharepoint site. My problem is that i am getting JavaScript error. How can i disable the JavaScript error? I don't want them to pop up. ...

Edit and render RichText

We have an application (a custom network management tool for building automation) that supports printing labels that you can cut out and insert into the devices' front displays. In earlier versions of the tool (not developed in my company), the application just pushed the strings into an Excel file that the field technician could then ma...

Winforms Bind Enum to Radio Buttons

If I have three radio buttons, what is the best way to bind them to an enum which has the same choices? e.g. [] Choice 1 [] Choice 2 [] Choice 3 public enum MyChoices { Choice1, Choice2, Choice3 } ...

How to get the list of forms in VS2008 C# project ?

I want to get a list of all the forms in the project i am running a form from . Suppose i am running a project which has 4 forms 1.Form1 2.Form2 3.Form3 4.Form4 and i want to retrieve the list of them for further direction which form to direct to ...