winforms

windows application setup problem?

I developed a window application and setup for that application, when i click the setup it is open and when i clicked for second and third time and so on it is opening again and again. please help me in this situation thank u. I developed the application in C# language.it is running perfectly but when i click the setup again it is openi...

Any good Wizard libraries for Winforms?

I'm looking for a good "Wizard" library for Winforms. WYSIWYG editor preferrable, but not a must. ...

How can I reference a method from another class without instantiating it?

I don't want to create an object because it won't affect my visible form. How can I call a method so it does its thing in the visible side of things. public class foo { public void SetString(string foo) { label1.Text = foo; } } Inside another class: foo X = new foo(); X.SetString("testlololol"); This will set the la...

Using ScrollBars in .Net

Is there any way to Use the Builtin ScrollBars that comes with each .Net ScrollableControl without setting the AutoScroll Property to Enable? Here is the issue, even If I Enable, set to Visible and declare min and max values as well as the smallChange and LargeChange for the HorizontalScrollBar and VerticalScrollBar they show up in the b...

Resize Form in Windows Forms and Localization

I have a Windows Form form that I changed the size from the default. The form is localized so I have resx files associated with it. When I run the en-us version of the form, the form size shows just fine with the new size. However, when I run the form using a different language, the size of the form reverts back to the original size. ...

Problem passing data back from a child form

Hi everyone. I got this problem: private void loadStringToolStripMenuItem_Click(object sender, EventArgs e) { StringLoader frmStringLoader = new StringLoader(); string test = frmStringLoader.Result; frmStringLoader.ShowDialog(); MessageBox.Show(test.ToString()); } And the...

DateTimePicker displays today's date instead of displaying its actual Value

We have a couple of DateTimePickers on a custom UserControl, on a Form. They are visible, but not enabled (for display purposes only). When the UserControl is loading, the DateTimePickers are assigned values from a DataRow that came from a DataSet which stores a single record returned from a SQL Server stored procedure. There is an inco...

Winforms data binding for TextBox

I have a basic property that stores an object of type Fruit: Fruit food; public Fruit Food { get {return this.food;} set { this.food= value; this.RefreshDataBindings(); } } public void RefreshDataBindings() { this.textBox.DataBindings.Clear(); this.textBox.DataBindings.Add("Text", this.Food, "Name"); }...

How to check if a item is selected in TreeView (C#)

How do I check if an item is selected in a TreeView? In C# I want to check if anything is selected, not a specific item ...

Handling Keyboard at Form level

I have a Form with several special controls on it that is the main window of my application. I would like to capture all key presses while my application is running, at the form level, rather than on the focused control or anything like that. What is the standard way to do this in WinForms? ...

Small, editable table of strings. Which Forms control do I want? (.NET)

I have a small array of structs, each struct has three fields, all strings. I want to display these structs in a grid, let the user edit the strings a la Excel, and then retrieve the edited strings of course. Which WinForms control is best for this? Tried a DataGridView but setting the DataSource to the array of structs doesn't seem to ...

Poor image quality in ListView

I'm populating a ListView with items and add images from an ImageList (in the designer). The images, however, are displayed in very poor quality, even though I've set the image size in the ImageList to their original size (16x16). Have a look: The original images are beautiful, sharp PNG icons. What can I do? ...

Removing a Control from a Form

Hello, So I've got some serious problems with removing a Control from a Form of my application. It's kinda messed up but I can't change anything. I have a form and I have a separated user Control. The control opens an exe file and shows a progress bar while loading it's bytes. And here comes the problem. I do all of it with a BackgroundW...

WinForms - why aren't my exceptions caught?

Hi, In my multithread server I am using following code (before running Form itself or course) AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomainUnhandledException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(ApplicationThreadException); The called methods...

Hide scrollbars of a RichTextBox

I'm trying to write a simple text editor like DarkRoom with just a RichTextBox (or alternatively a TextBox) in it. My problem is that I can't use the mouse wheel for scrolling unless I have a vertical scrollbar. Is there any way to hide this scrollbar and still be able to scroll with the mouse wheel? So far I have several ideas how this...

Adding rows to DataGridView in VB.NET

I have a DataGridView set up with the following columns: Teacher, Subject, Date, Period. After a lot of Googleing I can see there are a few ways to add data to the grid programmatically, with each one differing to another quite extensively. I wanted your opinion on how I should go about this, considering I am going to be adding data f...

What is the best practice to handle CheckBox Control in WinForm?

The winform: The code: using System; using System.Windows.Forms; namespace DemoApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { groupBox2.Enabled = checkBox1....

How can I get VS2008 winforms designer to render a Form that implements an abstract base class

Hi, I engadged a problem with inherited Controls in WinForms, and need some advice on it. I do use a base class for items in a List (selfmade GUI list made of a panel) and some inherited controls that are for each type of data that could be added to the list. There was no problem with it, but I know found out, that it would be right, ...

How to draw string on an image to be assigned as the background to a control in Winforms?

The string length can change, height is the same. The font is large for visibility. But how do I do this? I know painting on the control directly. But how do I do this without creating an image file, but all in memory. Because the string image will change with user interaction. ...

Painting on a listview disables the redraw on listview items

What's the reason for this? I override OnPaintBackground and draw a string. It doesn't show up until I call this in the constructor: this.SetStyle ( ControlStyles.UserPaint, true ); But then I don't see the items in the listview. Why and how to solve this? EDIT: code protected override void OnPaintBackground ( PaintEventArgs peve...