winforms

C# modify app.config

i want to change application settings at runtime, here part of it: <applicationSettings> <OPCClient.Properties.Settings> <setting name="Client_Service" serializeAs="String"> <value>http://localhost/test/service.asmx&lt;/value&gt; </setting> </OPCClient.Properties.Settings> </applicationSettings> i w...

Custom shape object in MS Office

I want to create some custom shapes for MS Office which we can use in house. For example I want to create a shape named “carton box” which have three – four default places where user can add some text. It is same as other shapes or I would say just like shapes (line, flowchart, arrow etc) in MS office 2007. Is there any way to create a...

C: Run-time vs Pre-loaded

I'm not sure if I got my terms straight here, but I was wondering: Is creating objects in run-time faster than adding objects to a form before running it? In case my terms are messed up, in the load function, you add this: lOptions.AutoSize = true; lOptions.Location = new System.Drawing.Point(7, 75); lOptions.Name = "lOptions"; lOptio...

Windows Forms: Using a user control like a container control

I have developed a simple Windows Forms User Control. I drag and drop this user control on a form. How can I achive, that now I can put further controls from the toolbox dirctly on the user control in the form? In other words, is it possible to use a user control like a container control? ...

c# Add HelpButton to a MDI child form at run time

Hi, i'd like the following code to work (where this. is a MDI child form) this.HelpButton = true; this.HelpButtonClicked += HandleHelpButtonClicked; this.Refresh(); this code is being called after the mdi child form is displayed. I wonder if i need to find some way of redrawing the title bar? David ...

System.InvalidOperationException: Value Dispose() cannot be called while doing CreateHandle()

In my windows forms app clients sometimes report a strange exception: System.InvalidOperationException: Value Dispose() cannot be called while doing CreateHandle() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing) at System.ComponentModel.Component.Dis...

Update C# client whenever database is updated

I am using MySQL with C# / Visual Studio 2008. I need to know any method so that if one user updates the database, all the logged in users over the network, are notified that a change has been occurred. If i logged in the database through my application, at that time the serial no of the latest record in the database was 10, and then i s...

Cannot localize (translate) a custom control in .NETCF 2.0

I am translating a compact framework 2.0 windows form in Visual Studio 2005. To do that, I change the language of the form to German (the target language) and edit/resize the controls on the form. This creates a resources.de.resx file containing the translated strings as expected. However, there is a custom control on the form, which ha...

Putting WinForm Labels Into An Array?

Let's say I have Label1 Label2 Label3 I want to do something like: for(int i=0;i<3;i++) { LabelArray[i].Text = "weee!"; } To populate the array, I know I can do something like: LabelArray[0] = Label1; LabelArray[1] = Label2; LabelArray[2] = Label3; But that doesn't seem smart just because I have 50 labels, and that would be...

How do I kill a Windows Mobile 6.1 forms app process when the form is closed?

In the Program.cs file of the .Net CF 3.5 WinForms program I've written, I launch the app by instantiating a new instance of Form1. Application.Run(new Form1()); When I want to close/exit the application, I override the Form1 FormClosed event so that I can ensure exiting the application. // In Form1 code-behind private void OnFormClo...

How do I catch an exception in a GUI thread?

An exception is thrown in a user control based on a picture box, causing it to show the typical error image (red X). Since the GUI thread caught and handled the exception itself, I cannot easily find out where the exception occurred and debug. I'm currently wrapping the whole OnPaint code in a try-catch, and was able to debug the code, ...

TableLayoutPanel Labels Snap To Top Left?

Hi, I have a TableLayoutPanel and every time I put a label into one of the cells, it snaps to the top left corner. How can I get to it not do this or change where it snaps. Also, is it possible to change a specific cell's background color? Thanks! ...

A debugger to show me the names of the controls on the form

C# WinApps: what is a tool or debugger that I can use to see the name and values of the controls that I have drawn on the form at run time - I mean when I run my program I want to be able to use that tool and hover over controls on the form and that program show me the name and value of that control. ...

how to open a WPF dialog from a WinForms menu

I have a WinForms menuitem and I need that on menu click the new WPF dialog is loaded. How do I do this? Thanks ...

how to add a WPF dialog to a Winforms project

Hi I am using Visual Studio 2008 targeting .net 3.5 framework. I need to add a WPF dialog to a Winforms project. I was thinking that by adding reference to PresentationCore, PresentationFramework and WindowsBase.dll and copying a WPF dialog from a test WPF project to the WinForms project in question should do the trick, but after that wh...

How to color lines in a listbox?

Hy! I would like to make a logging system with a listbox, that highlights some of my lines, depends on my will :P So, if I have 4 kind of reporting, like, general, warning, error, debug. I add with somelistbox.Items.Add("Starting"); <-- I would like to drawn this as grey somelistbox.Items.Add("Error!"); <-- I would like to d...

A Frame Inside Of A Winform?

I'm not sure what it's called in the land of WinForms, but in web development terms, I'm looking for a frame type element that can be added to a winform. I want a panel that is anchored top,bottom,left,right but if the form the panel is resized to a smaller size than the elements in the panel, scroll bars will appear around the panel a...

DataGridViewLinkColumn cell can't write link winforms

I have a Form with a DataGridView. RMShyperlink = new System.Windows.Forms.DataGridViewLinkColumn(); //create a link column column dataGridView1.Columns.Add(RMShyperlink); //add to my datagrid for(int i =0 ; i < dataGridView1.Rows.Count; i++) { dataGridView1.Rows[i].Cells[0].Value = "http://localhost"; //i set the value //but the...

TableLayoutPanel Rows AutoHeight Around Text?

Hi I was wondering how I can get my TableLayoutPanels to resize (height) automatically depending on how much text is inside of them. for instance, if I have 5 lines of text, I'd like my row to be 5 lines high, if I have 1 line of text, I'd like my row to be 1 line high. This is the way tables work natively in HTML, and that's basicall...

How do you inject a header using the Navigating event in WebBrowser in Windows.Forms (C#)

I'm trying to solve a problem where I'm intercepting a request in Navigating and want to inject an additional request parameter into that request before passing it off. Here are the steps: First I make a request via WebBrowser.Navigate. I have an event handler to capture the Navigating event. The request hits the Navigating event (be...