winforms

Updating UI from a different thread

Hi, I know this question has been asked before, but I feel it wasn't asked correctly. I have an intensive operation and I'd like the UI to remain responsive. I've read a few posts that say Background worker is the best way to go, however, I think this assumes you have the source code to the intensive task. I have a library that I have...

Application Icon

I have 3 icons. When I compile application I use first Icon - main app icon. And I have 2 other icons in resources. When I show MessageBox.Show(...) the first app icon appear in task bar. I want to have an ability to change the main icon at runtime at some reason. ...

How to use safe threading for a timer(Change timer properties from different thread)

Hello, To access a memo on my form,I use the following code public string TextValue { set { if (this.Memo.InvokeRequired) { this.Invoke((MethodInvoker)delegate { this.Memo.Text += value + "\n"; }); } ...

How to access a timer from another class in C#

See Also: http://stackoverflow.com/questions/725735/how-to-enable-a-timer-from-a-different-thread-class The timer is assigned to a form and I'd like to Enable it at a specific location,but from another class.I don't want to make it public This is the code I use to access memo public string TextValue { set { ...

How to enable a timer from a different thread/class

Original post: http://stackoverflow.com/questions/725413/how-to-access-a-timer-from-another-class-in-c I tried everything. -Event -Invoke can't be done,because Timers don't have InvokeRequired property. -Public/internal property Nothing worked,the code is being executed,the timer.Enabled property is being set to "true" ,but it doesn...

Richtextbox.invoke, C#, Form Still hanging

I've written a c# application to run an external program and i've redirectet it's output to a richtextbox in my form. I've created the process using the following settings p1.StartInfo.RedirectStandardOutput = true; p1.OutputDataReceived += new DataReceivedEventHandler(outputreceived); and in the outputreceived event void outputrecei...

How can I make my browser unique?

I just made a browser using c# as one of my first projects of programming and it works pretty good but its pretty generic. I tried adding different tools on it but it still ends up pretty bare and I'm better off using Firefox. Is there a way to add useful apps and color on your browser. I want to make it more personal and add things that...

Why does a binding fire even if the bound property doesn't change?

With the code below I get both the "Firing C Binding" message and the "Firing F Binding" message. Why is that? I'm only expecting to get the "Firing C Binding" message. using System; using System.Drawing; using System.Windows.Forms; using System.ComponentModel; class Program : Form { private Label lblC; private Label lblF; ...

AltGr in System.Windows.Forms.Keys enumerator

Should be an easy one. What is the value of the AltGr key in the System.Windows.Forms.Keys enumerator? I've looked through it and can't see anything obvious ('AltrGr' no, 'RAlt' no, 'GrAlt' no). Thanks Simon Updated - Answered: if (ModifierKeys == ( Keys.Control | Keys.Alt ) ) { // AltGr is held down ...

Where is the correct place to put the code that writes a DataTable to XML when it needs to reference the parent DataGridView?

I've got a DataGridView using a DataTable as it's DataSource. I'm allowing the user to alter the visibility, order (and width though that's not relevant to this question) of the DataGridView columns, but not the underlying DataTable. This means I don't have to recreate the DataTable every time the user makes a change to the view. The us...

Windows Forms ListView missing horizontal scrollbar

I have a Windows Forms ListView in a form (C#, VS 2005) and have it anchored to all the edges of the form so that it entirely fills the form excluding the status bar. The ListView is in detail mode and the columns are very wide - definitely wider than the display area. I have a vertical scrollbar but no horizontal scrollbar. I can scr...

C# Command Line arguments problem in Release build

I have what seems to be a simple problem that I can't solve myself. I have a WinForm app, with main method modified to accept command line arguments like this: [STAThread] static void Main(String[] args) { int argCount = args.Length; } This code works fine and argCount is equals to 2 when compiled in debug mode...

Cross tab data control for winform.net 2.0

Could anyone suggest me any winforms controls for showing cross tab data in .net? Updates: 1. The control should be editable 2. Binding support will be add-on feature. ...

C# + Custom graphics on controls?

Hi, I was just wondering if there are ways of creating my own custom winforms controls? I've been plundering with Visual Studio 2008 now trying to do some c# apps. And the GUI end up looking terrible because of the standard winforms limitations. And I noticed that I can add images to buttons for example, but ther's no hover effect. Or,...

C#: How to add subitems in ListView

Creating an item(Under the key) is easy,but how to add subitems(Value)? listView1.Columns.Add("Key"); listView1.Columns.Add("Value"); listView1.Items.Add("sdasdasdasd"); //How to add "asdasdasd" under value? ...

C# How to invoke with more than one parameter

Hello, I use the code below to access the properties on my form,but today I'd like to write stuff to a ListView,which requires more parameters. public string TextValue { set { if (this.Memo.InvokeRequired) { this.Invoke((MethodInvoker)delegate { ...

Opening a WPF Window in another Thread from a Windows Forms App

OK, I should start this off by saying I'm not sure this is necessarily the right way to deal with this but... Basically I have created a Window in WPF for displaying notifications in my application (a bit like Outlook New Mail notification). I would like to try and show this Window in it's own thread (it might do some work in the future...

Int To String?

Hello, I have a listView on my form.I want to add stuff to it durring the program is running. This is the code I use public void FillList(string[] Name,int[] empty,int[] Population,int[] Max,int[] Check,int size) { if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { ...

Differentiating between events raised by user interaction and my own code

The SelectedIndexChanged event gets fired in my application from a combo box when: the user chooses a different item in the combo box, or when: my own code updates the combo box's SelectedItem to reflect that the combo box is now displaying properties for a different object. I am interested in the SelectedIndexChanged event for case ...

Winapp (c#) calling java app -> set progressbar

Hello, I've got a C# winapp that communicates with a java app to retrieve data over tcp. Now I want to add a progressbar for the waiting and showing that the download of the data is busy. Because at this moment the winapp freezes until it has all the data from the java. Now I was wondering how I could program it. Because I assume that ...