winforms

Why isn't always possible to set a winforms dimensions?

I'm trying to size a checkboxlist control to 500,250 from its current 502,251 (It's an OCD thing) but every time I try, it just reverts to 502,251. Is it because the parent container is docked in the window? Are there any workarounds? (This is through the visual designer) ...

How to make this open a webbrowser inside a new form

private void button5_Click(object sender, EventArgs e) { if (domainUpDown2.Text == "Battlefield: Bad Company 2") { Form2 form2 = new Form2(); form2.ShowDialog(); } } All that does is open a new blank form, but i need it to open a new form with a webbrowser in it so i can set it url depende...

C# Multi threading- Move objects between threads

Hi, i am working with a winforms control that is both a GUI element and also does some internal processing that has not been exposed to the developer. When this component is instantiated it may take between 5 and 15 seconds to become ready so what i want to do is put it on another thread and when its done bring it back to the gui thread ...

Backgroundworker halts in between

I am starting a process lets say abc.exe in a background worker. In the beginning everything works fine but in between the newly created process i.e. abc.exe halts. Although I am starting abc.exe as hidden window but I come to know about its hang as it stops doing log writing. When I close my UI form then again abc.exe starts working. ...

If I want to create multiple forms, possible to have one main in C#?

If I want to have multiple forms in an appication, can I do it with only one main? I am working with Visual Studio C# (Windows Application). Thank you. ...

How get to work ShapeContainer.Scale methods?

Microsoft.VisualBasic.PowerPacks How should I get to work ShapeContainer.Scale methods? Are they implemented? private void button1_Click(object sender, EventArgs e) { // this works for the common form controls this.Scale(new SizeF(1.1f, 1)); // // but has any effect on the powerpacks.Shapes ...

Determine if app is WinForms or WebForms

Is there a way to determine if running app is WinForms or Web at runtime? [Edit] Is there actually a problem if I reference both System.Web and System.Windows.Forms in my class library? [Summary] (so far) What I've learned so far: HttpContext.Current is null if checked in an async thread, so it cannot reliably be used in a helper m...

Managing Lots of Overlapping Controls in Visual Studio

I'm using different sets of controls on the same location on a form. By default all are visible=false and then certain subsets of the controls are set to visible as the user selects specific values in a combobox dropdown control. From the user's perspective this works well since they only see the controls that are needed. However, sin...

Using assembly names containing the word "update" in Visual Studio 2005

I've been using Visual Studio 2005 for a few years and I've come across a problem which I'm wondering whether its me being stupid. I'm using Windows Vista and I can't debug a project with an assembly name containg the word "update" without running Visual Studio in administrator mode. For example, I created a new windows forms applicati...

How to get the right row in a sorted DataView?

Hi, I have a DataGrid containing a small table. Until now, I had a double click handler on this grid which iterated over all rows to find the selected one: DataTable table = (DataTable)this.dataGrid.DataSource; int selectedRow = -1; for (int i=0; i<table.Rows.Count; i++) if (this.dataGrid.IsSelected(i)) selectedRow = i; break...

Passing object to different windows forms

Hi, I want to pass a C# object between win forms. At the moment, I have setup a basic project to learn how to do this which consists of two forms - form1 and form2 and a class called class1.cs which contains get and set methods to set a string variable with a value entered in form1. (Form 2 is supposed to get the value stored in the cla...

How to print a web page without using the WebBrowser control

Hi there, We are using a client application to print out grade sheets from an online application. This has been working flawlessly until the systems were upgraded to IE 8. I now receive this error (Access Denied): http://img707.imageshack.us/img707/5259/62270489.png Apparently, this is a known issue and it cannot be solved. How can I ...

What is the best way to call a method right AFTER a form loads?

I have a C# windows forms application. The way I currently have it set up, when Form1_Load() runs it checks for recovered unsaved data and if it finds some it prompts the user if they want to open that data. When the program runs it works alright but the message box is shown right away and the main program form (Form1) does not show unti...

Open Form2 from Form1, close Form1 from Form2

now,i have two form,called form1 and form2,in the form1 there's a button,when i click it,then open the form2 question: in the form2,i want to creat a button when i click it,the form2 close and the form1 close.how to do? thx ...

how to join thread working with another one

Hi all, I have a thread changes in a control in a form in a windows forms application, I implement the invoke method for prevent threading cross access, but when I close the form, the second thread still work and try to access to the control and throw an object reference not set to an instance of object exception how can I assure pre...

c# bound Datagridview

I have a datagridview and it is bound to a stored procedure which returns a number of result columns. There is also a binding navigator with "Add New" button included. If I click "Add New" button, it creates a new row in datagridview automatically, and If I leave that new row by clicking a different row. datagridview invokes "commit"...

gridview and textbox multiline like visual studio errors

Hi all, I use vs 2008, windows forms, c# I have a Collection of OracleErrors, that I gather of sqlplus.exe output:, List, and entity OracleError: public class OracleError { public int NumberLine { get; set} public string SourceFile { get; set} public string Error { get; set} } Now, in my form, I use DataGridView and TextBox Mu...

C# USer Interface Books - Equivalent To CLR Via C#

I need to teach myself Winforms and user interface programming and want a decent book that will go thoroughly into the ins and outs of how to accomplish things. Can anyone suggest a good book? I know C# pretty well and have messed about with Winforms in the designer before. Thank you ...

Getting Selected Items From WinForm ListBox?

I have a ListBox in a WinForm with multiselect enabled. The selected items appear to be stored in an object, how to I get their values? ...

How to prevent Windows Forms designer from generating default value assignments for properties?

I have a user control with a property that is of a reference type. The Windows Forms designer keeps generating code that assigns the property's initial value to null. How can I prevent this? I tried adding Reset and ShouldSerialize methods -- Reset had an empty body and ShouldSerialize always returned false -- but that did not work. ...