winforms

Get http file size, download location, and URL in a label.

I am using this to download a file and get % info and completed info. I want to know how to get the size of the file being downloaded and the URL remote address and the local address where the file is being saved to. private void Form1_Load_1(object sender, EventArgs e) { label21.Text = "Download in progress..."; ...

using datagridview for update and delete data

I have some question about DataGridView. I can show table in DataGridView, but I don't know that after update data in DataGridView how can I update that fields in table? how can I delete selected rows in DataGridView and table in SQL Server? I don't want to let user insert data with using DataGridView. If I want to let to user to inser...

Problem deriving from ToolboxItemAttribute in .Net, Winforms

As an example, here's a simple attribute, derived from ToolboxItemAttribute: <ToolboxItemX(False)> _ Public Class Class1 Inherits Button End Class Public Class ToolboxItemXAttribute Inherits ToolboxItemAttribute Public Sub New(ByVal defaultType As Boolean) MyBase.New(defaultType) End Sub End Class The probl...

this.Visible is not working in Windows Forms

I have a problem. I need to hide my window at window load. But private void Form1_Load(object sender, EventArgs e) { this.Visible = false; } is not working. And property Visible remains true. Am I missing something? ...

3 forms Show and ShowDialog not working as expected, BUG?

I am using Visual Studio 2010, C# .NET 4.0. I have 3 forms: Form1, Form2, Form3. In Form1 I have a button to open Form2: private void button1_Click(object sender, EventArgs e) { Form2 f = new Form2(); f.Show(); } In Form2 I have a private Form3 variable always pointing to the same Form3: private Form3 f = new Form3(); And ...

Exception with WebClient.DownloadFileAsync

I am trying to download a zip file on my server by doing WebClient.DownloadFileAsync(new Uri(DownloadLink), Path.GetFileName(DownloadLink)); I have events linked to download completed and progress changed and when the download gets to 99%, it stops. So I give it a minute and then it gives me an exception: ...

How do I get to the Design Tab in Visual Studio 2010 for Windows Form programming?

Hello. I am new to Visual Studio 2010 and I am trying to develop a Windows Form. I do not see a Design tab where I can toggle between the form design and the .cs code. How can I do this? Thanks ...

Listview Control problem

I have a Listview control "lstStudents" and i have added checkboxes inside the List viewControl.I need to add a Select All check box which results in checking all the checkboxes inside the ListView i use the following code but it doesn't work. private void chkAll_CheckedChanged(object sender, EventArgs e) { foreach (Contro...

Is it possible and How to drag and drop GDI object ?

I have found this analog clock tutorial here: http://www.codeproject.com/KB/selection/AnalogClockControl.aspx Now is it possible to drag and drop the hand hour (how to detect the mouse on the hand hour ?) and show this hand hour moving while dragging it ? I mean isn't anything included framework in .NET which allow me to detect that t...

C# WinForm Timers - Notify parent class that a timer event has been raised.

I have a parent class that contains an array of objects each with a timer associated with it. I want the parent class to be able to start and stop these timers, and most importantly want the parent class to detect which of the it's child objects 'timer elapsed' even has been raised. Is this possible and if so what is the best way to do...

region - date & time question

hi in my C# program i receive date & time like this: DateTime.Now and i get: 19/09/2010 20:10:30 because my region is: Hebrew (Israel) but What happens if I'll install my program on computer with region English (united states) I'll probably get an error because the format is MM/dd/yyyy hh:mm:ss my question is, How to ensure that i ...

How to get SQL Server CE TableAdapter to commit to database?

VS2008 project. Created local database (SSCE). Created dataset with tableadapter. Dragged dataset and tableadapter to the form so I can reference it in code. New records successfully add to the dataset but will not commit back to the database. Gives no error or clue why it won't work. TableAdapter insert statement was created autom...

With a windows Application (winapp) when/where should i Dispose of my UnitOfWork?

Hi folks, I've got a windows application that creates some threads to parse some txt files. Nothing too crazy. I'm using StructureMap Dependency Injection to create any instances of my Services and Repositories. So my Winform has a static property which returns the instance, based on what's been registered. Works great .. except I'm n...

Self Sorting Listbox

Totally stumped by something that seems easy, and has been done to death... Yet still stumped. What I want to do: I've got a WinForms ListBox. Its items are populated with objects, the DisplayMember is set. As the app runs, the data in the listed items might change, including the field behind the DisplayMember. I want the text disp...

Margins around the System.Windows.Forms.Button

How can "solid" margins be made around System.Windows.Forms.Button control? var button = new System.Windows.Forms.Button(); button.Dock = DockStyle.Fill; button.Margin = new Padding(20); var panel = new System.Windows.Forms.Panel(); panel.Controls.Add(button); In the example above the button wo...

Setting TabControl Alignment Properties. C# Winforms

I'm trying to do like what you can see on the image below: I'm using Microsoft Visual Studio 2008. In my Form I added a TabControl and set its Alignment properties to Bottom. But as you can see in the image below, It seems there's something wrong in the display. How can I fix it? ...

How to intercept the TAB key press to prevent standard focus change in C#

Normally when pressing the TAB key you change the focus to the next control in the given tab order. I would like to prevent that and have the TAB key do something else. In my case I'd like to change focus from a combobox to a completely different control. I can't do this by setting the tab order. I need to do this programatically. Any id...

Status Messageboxes going behind the application

I have a situation like this..I have a windows application (Single threaded) that has one main form. After performing some operation, I'll get a message "Operation completed successfully" But most of the time it goes behind my application and hence it is not visible. Any idea why this is happening ? Thanks in Advance ...

c# how to prevent user from resizing my application window?

I don't want any user to resize my application window. how can I do that? ...

Retain the dialog to be open after ShowDialog result

Hi All, I'm opening a modal dialog asking the user to fill certain fields. if(dlgUserDetail.ShowDialog() == DialogResult.OK) { } On click of OK, the control comes to the parent form where I'm validating the user input. If the validation fails, I wanted to keep the dialog to be open with the old values. Since it is modal dialog, th...