winforms

How to open a new form from another form.

I have form which is opened using ShowDialog Method. In this form i have a Button called More. If we click on More it should open another form and it should close the current form. on More Button's Click event Handler i have written the following code MoreActions objUI = new MoreActions (); objUI.ShowDialog(); this.Close(); But what...

Delete Functionality in RichtextBox (Windows Forms with .NET 3.5)

Hi, I am facing a problem to implement the delete functionality. The Key_Down event is not getting raised when I pressed a delete key from Keyboard. If I implement the Key_Press OR Key_Up Event. Suppose I have selected some Text from RichTextBox and pressed the DEL, then the text get removed first and then it reaches to the Event code...

error handling with BackgroundWorker

I know, that you can handle BackgroundWorker errors in RunWorkerCompleted handler, like in next code var worker = new BackgroundWorker(); worker.DoWork += (sender, e) => { throw new InvalidOperationException("oh shiznit!"); }; worker.RunWorkerCompleted += (sender, e) => { if(e.Error != null) { ...

Send Form to class

How do I send the form to the class? You are making some object? for example : class Myform { public void Myf(Form) { Form f = new Form();//error } } private void Form1_Load(object sender, EventArgs e) { Myform mf = new Myform(); mf.Myf(Form1);//error } ...

DataGridView: How to enable multi row select but disable multi cell select?

Hello everyone, I'm looking for a way to enable multi row select in a DataGridView-Control but disable multi cell select. What I've tried so far: DataGridView.MultiSelect = true allows to select multi rows and cells ClearSelection() in DataGridView_CellMouseClick-Event and re-select the last selected cell doesn't look very nice (you ...

how to show the subroots(childroots) while clicking on a particular rootnode.

Hii I am using devexpress xtratreelist in this i have a tree..now i want my form to work in sucha away that if the user clicks on a particular node all the subroots of that node shud be published on a list box or anyother control..How it can be done..please help me..urgent ...

How do I avoid 'Binding to Large CLR Objects'?

This guide on optimizing DataBinding says: There is a significant performance impact when you data bind to a single CLR object with thousands of properties. You can minimize this impact by dividing the single object into multiple CLR objects with fewer properties. What does this mean? I am still trying to get familiar with DataBin...

DataGridView: DateTimePicker cell customizations

I am using the following aproach to add a calendar control to a WinForm DataGridView. http://msdn.microsoft.com/en-us/library/7tas5c80.aspx Dim colReceived As New CalendarColumn() grdVisa.Columns.Add(colReceived) 'Loop through rows r, accessing calendar column c Dim CurrentCell As CalendarCell = CType(grdVisa.Rows(r).Cells(c), Calenda...

Why blank space in my file are missing when i tried to open a file

Hi all, I write a small code to open the file my file contents are as follows each line length is 94 characters and line terminator is \r and \n 101 111111111 1111111111010190542A094101 9000000000001000000000000000000000000000000000000000000 // same Works for this text 101 111111111 111...

Tweak WPF application performance which hosts hundreds of similar controls

Hello, We just ported our WinForms application to WPF. However, performance decreased dramatically. We have a User Interface which consists of about 200 UserControl. Each UserControl is defined by a DataGrid (= 10 columns and 3-15 rows) as well as a Panel which hosts about 10 Buttons. They are all hosted in a ScrollViewer. (Please do...

What is the enum for - (minus/underscore) and = (equal/plus) key in Keys enumeration?

I can't seem to find them here. I'm trying to get them include in my hotkey selection dialog. ...

Close all forms in vb

How can i close all forms I use wpf vb 2010 To load other form i use like Private frm As MainWindow = New MainWindow to open the window i used frm.Show() and to close it i use frm.Close() Now I have two forms like form1 and form2 I want to open form2 when i click on the button - ok it's easy The Question How can i closed fo...

C# - List of Multiple progress bars. What components to use?

I have an app that requires multiple progress bars to be added dynamically to a form (whenever a new upload is added and started). I've been Googling and the results suggested embedding progress bars in a ListView or a DataGridView. Can anyone suggest any other techniques, as neither ListView or DataGridView hacks I've seen so far seem...

Determine which control is closest to the mouse pointer

In my C# (.NET 2) app I'd like to determine which control is closet to the mouse. I can think of a few ways to do this that won't quite work right. I could use the Control.Location property, but that just gives me top/left, and the mouse might be on the other side of the control. I could calculate the center point of a control, but larg...

WinForms autosize vertically while leaving width adjustable?

Is it possible to use WinForms layout engine to set up a form in such a way that the height is adjusted completely automatically to fit the content, but the width would be adjustable by the user? As an example, consider the following somewhat contrived form: TLP: TableLayoutPanel, with 1 row and 2 columns. label1: Label, contained in ...

Problem with [DefaultValue()] inheriting ComboBox

Hello, for a project of mine I inherited a ComboBox to change its size behaviour. In addition to this i wanted, to speed up my forms' creation, to set the default DropDownStyle to ComboBoxStyle.DropDownList To do this i used the [Default()] command overwriting the DropDownStyle property [DefaultValue(ComboBoxStyle.DropDownList)] public...

Anchoring a button that is inside a panel

I have a panel anchored to top-left_BOTTOM of the form. there is a button at the bottom of this panel that I want to move correctly when I am resizing the form by pulling down the bottom edge of the form. but now the panel is moving correctly but the button does not. what should I set to do this? thanks ...

c# whats the best way to end a program?

in vb.net it is end what is the best way to end a program in c#? ...

c# win application

int a, b; private void Form1_Load(object sender, EventArgs e) { this.Width = 600; this.Height = 436; for (a = 1; a <= 8; a++) { for (b = 1; b <= 8; b++) { Button btn = new Button(); btn.Name = (((a - 1) * 8) + b).ToString(); ...

Checking TreeView Control Nodes and SubNodes - StackOverflowException!

I have a Tree View control for a Windows Application that uses the CheckBoxes property. Sometimes (often) when a Tree Node is either checked or unchecked, I get Stack Overflow Exceptions in my static methods below. Could someone point out why? Maybe even show me how to do this the right way? In the After Check Event, I have written th...