winforms

Is it possible to set a command button to have a 3D disabled graphic in Visual Studio 2008?

I've recently started a WinForms project in Visual Studio 2008 and I notice that when I disable a command button, it flattens out the button and leave the text black. This is quite an unexpected change from my experiences in VB6 and VS2005 where the button simply grays itself out. Is there a setting that would allow me to make the disab...

How to ensure all changes in every controls applied to the DataSet before the data save to the database ?

When I develop using Delphi I always call DataSet.CheckBrowseMode() to allow bound controls to apply its pending changes to the DataSet. I've been looking for similar way in .NET I've tried // When the user press Ctrl-S // Apply any pending edit this.TheDataBindingSource.CurrencyManager.EndCurrentEdit(); // then save the data this.S...

C# 2.0 generics: How to create an Action object with zero parameters

First of all, I'm using VS2005 and C# 2.0. I'm trying to set a combobox' Text property from inside the SelectedIndexChanged event. From another thread here on StackOverflow this was proposed done the following way: BeginInvoke(new Action(() => someCombobox.Text = "x" )); Now, first of all this returns a compiler error for me. I belie...

how i clear all data in datagridview and it would not effect in delete data - vb.net

hihi, how i clear all data and not delete data or column in datagridview? i wan clear the data first and query on the result to make the result not duplicate.. can anyone help me?? ...

How to detect if we're on a UI thread?

For the sake of argument, consider a UI thread as a thread that has had a call to Application.Run() or one of it's overloads called on it and has an active message loop running. Is there a way of detecting if we're currently executing on such a thread? The reason I want this is because I have a class with a private function that is lon...

Creating a WinForms custom container control with some non-removable controls

I've written a custom tab control (FooTabControl) which hosts specific tab page controls (FooTabPage instances). The FooTabPages know to place themselves into a dedicated area within the FooTabControl. Now I wish to have the FooTabControl also host a System.Windows.Forms.Panel child control (in another dedicated area of the FooTabContro...

Visual Design Application: WPF or WinForms(GDI)?

Hi, I have to develop an application with which my client will do visual design. By this I mean the graphical display and manipulation related entities. (Similar in principle to ERD, but obviously then again, completely different problem area) Think of Visual Studio which has a toolbox, each item has some properties etc. Items have cer...

issues of creating a new Windows Form in C#

Hello everyone, In the button click even handler of Form1, I want to create Form2. Here is my code, even handler of button1 of Form1 // button1 belongs to Form1 private void button1_Click(object sender, EventArgs e) { Form2 form2 = new Form2("www.google.com"); form2.ShowDialog(); } Form2 contructor public Form2 (string str)...

C# Windows Form disappears suddenly!

Hello everyone, I am using C# + VSTS2008 + .Net 2.0 to develop a Windows Forms application. In button1 event handler of Form1, I create Form2, then Form2 appears. Then when trigger event handler of button2 of Form2 (button2 is Form2's UI button element), after executing button2 event handler, Form2 will disappear. Here is part of my cod...

Where can I find code samples for XNA with WinForms?

I'm trying to make a WinForms application with embedded XNA according to this sample: http://creators.xna.com/en-US/sample/winforms_series1 What I'm looking for are code samples that use code sample above to study more on the subject. I'm creating a desk game. Thanks for help ...

do I have to call all the exposed dispose functions of the controls within a windows form in the overriden dispose function?

Hi all, I have a windows form that contains many controls e.g timers, gridviews, and binding sources etc, and all of these expose a dispose function. Do I have to call their dispose function in this protected override void Dispose(bool disposing) { if (disposing && (components != null)) { compon...

Winforms execute code in separate thread

Hi there, a bit of a juvenile question... I realise that in a Winforms app, long running code should be executed in its own thread. How does one accomplish this on say, a button click event? I want to do this in an effort to free up the UI thread so that I can simultaneously overlay the current form with a semi-transparent modal dialog...

Can't assign TreeNode to Treeview.SelectedNode

private void WalkerRefreshNode(bool refreshAllNodes) { TreeNode selectedNode = tree.SelectedNode; TreeNode bufferedNode = (TreeNode)selectedNode.Clone(); if (SelectedNode.Tag != null) { DataRow tag = (DataRow)selectedNode.Tag; if (tag.Table.TableName == "example") ...

C# Winform looping event on Press Button

Hi, I made two buttons which controls scrolling on a DataGrid OnClick. I'll like to execute the code managing the scroll when users stay press on it. I tried on MouseDown() but the code is execute only one time. Need help. ...

Query for a search form

I'm developing a search form. It has about 10 fields and a search button that retrieve records from a table and put them in a gridview. The user can fill some fields, all the fields or none, and then click Search. Only the fields with info has to be used to perform the search. I use a query in a tableadapter of a dataset to make the sea...

Expression_Host assemblies keep growing in numbers

Hi, I have a WinForms 2.0 application with about 18 Reports created with Microsoft ReportViewer. Every time a report is started there is a dynamic assembly created (expression_host_xxxxxx.dll). This dynamic assembly is loaded in memory and is there to stay for the remainder of the application runtime consuming resources. Even if we only...

Any way to remove notify icon in event of a crash?

Is there any way to automatically remove a NotifyIcon in the event of a crash? (I know you can mouse-over to remove it) I'm running windows xp. ...

Localizing and Globalization of WinForms applications

Hi, We've developed a WinForms application (targeting .NET 2.0 with VS2008), we've just found out that we need to localize it for use in another language (other than english) :( What are the guidelines for developing multi-lingual languages in .NET? Another application borrows Paint.NET's idea of globalization (using resources) but I w...

Capturing KeyDown events in a UserControl

I have a user control with several child controls. I need the user interface to react to keypresses, so I decided to put the handling code in a MainControl_KeyDown event. However, when I press a key in my application, this event does not fire. I have found a solution through a search engine which relies upon use of the Windows API, whic...

i want to write a code where after saving the file by savefile dialog and then editing it again to save the savedialog box should not appear

i can save a file using savefiledialog . once the file is saved and if we edit it and then save it again then it should be saved without opening the savefiledialog.please help me with the code. This code is made in Visual Studio 2005 in Windows forms. using System; using System.Collections.Generic; using System.ComponentModel; using Sy...