winforms

Banishing the Command Prompt Window (WinForms)

Hi All, I have a problem over here. You see, I wanted to create my own sample application in C# but without Visual Studio creating the files automatically for me. So I figured that I'd simply select "Empty Project" and then create the Program.cs file myself, and then manually add a Winfows Form from the Project menu. That went good. Bu...

Caching Control instances

Hi all, My application has a navigation framework where each data entry screen is implemented as a usercontrol. Some of these UserControls are very large, and on slow systems can take a few seconds to construct. In an attempt to speed things up, I'm considering caching these control instances instead of instantiating them each time I...

Terms Conditions Disclaimer for Application?

Hi All, I was told that I need to have terms and conditions or disclaimer for my program that the user needs to accept before they can install it, is this true? And are there any places online that you may use to get them? ...

How to enable Drag & Drop for all the children controls

Hello, My situation is as follows, I have win-forms applications with DockPanel Suite and lots of controls, which cover the entire screen, I want to enable D&D of files from the windows explorer to the application. I know how to implement the D&D, but it seems that if i enable it for the main parent form, only the applications title-ba...

C# List View Ordering

I'm coding in VS2008 using C#. On my form, I have a ListView control. Now, it's purpose is for the user to add items to it. However, each new item is added AFTER the last item in the list. Is there any way to have each new item be put as the first item in the list? ...

TreeView Population Via Database Question

I want to populate the treeview strucure in windows application using C# and I have a table structure in database: table1 folder | -->folderid | -->foldername table2 file | -->fileid | -->filename table3 fillfolder | -->id | -->folderid | -->fileid That file is always the child of the folder, but how I can populate the...

C#: Proper way to close SerialPort with Winforms

I have an app where I read from the serialport, everything goes fine, until I close the app. When I click on the [X] the app simply hangs, the UI: unresponsive. I read from the port in the DataReceived event handler, and I close the port when FormClosed happens: private void MainForm_FormClosed(object sender, FormClosedEventArgs e)...

Textbox in Visual Basic help!

Lately I have been programming an application in Visual Basic 2008, and on one of my Windows Application forms I have several text box forms, and with my code the way it is, none of them can be enabled, and they must all be set to Read Only. Now if I put a big block of text in one of the Text Box's that extends past the parameters of th...

Progress Bar C#

I have a progress bar to show the status of the program loading songs into the library. foreach (Song s in InitializeLibrary()) { Library.AddSong(s); pBar.Value++; pBar.Update(); } InitializeLibrary() is just a function that returns a List The problem is that the progress bar stops "moving" after a...

Run a modal dialog on a non-UI thread

I'm writing a simple data UI using standard .Net databinding to a typed DataSet from SQL Server. I have a reload button which calls Fill on all of the DataAdapters to get new data from the database (in case another user changed the data). This takes some time, during which the UI is frozen. It must be run on the UI thread or the datab...

How to interact with other application forms

I am looking for a way to once I see a form by Name add a button to that form and when the user clicks the added button, pull information from the form. For example, if I see the for title - "Stack Overflow - Wnidows Internet Explorer" I would add a button "MyButton" on the form, and when that button is clicked, I would "pull" the infor...

Font Size on Winforms

If I have a Control, I can know the Font it is using by the Font Property. Now how can I know the average Size of the Font( or lets say I would like to know what would it be the width of the 'M' char) I know that Graphics.MeasureString() would solve my problem but implies creating a graphic object since I'm not in any paint event.. or...

DateTimePicker resets day

Hi all, I am using DateTimePicker with Australian date formatting set (dd/mm/yyyy) The problem is when user enters a day which is outside of the month (mm), control resets that day to "1". This obviously is a quite confusing obstacle for user - it's not natural to enter the month first and then enter the day [culture-wise] Is there a...

How do I play movies in a C# WinForm application

Hello All. I am trying to play a movie (wmv,avi,mpg,etc.) in a winforms application. I would like the user to be able to start, stop and pause. I'm not looking for a full answer ... I just need pointed in the right direction. I've already did some searching on google but could not find anything useful. I can continue searching but I kn...

Is VS2008 Written in c#/.net

Obviously VS2008 is written in part in c# but I'm wondering to what's extend. Is c# the driving force with win32 interop or is it mostly win32 with some c# interop ...

Drag and drop a html table into another application

I'm having a problem dragging an html table from my C# winforms application into an external application (Outlook email message) and getting it to render as a table instead of a plain text version of that table. I know that when you copy/paste in the clipboard you have to put the table in CF_HTML format but that doesn't seem to help with...

webservice(.asmx) issue

i have a webmethod in my webservice public class Service : System.Web.Services.WebService { [WebMethod] public int ADD(int a,int b ) { return a+b; } } i need to implement it in a windowapplication which contain a textbox .i added webreference there with foldername "localhost" and URL as "http://localhost:4484...

How to sort databound DataGridView column?

I know that there are a lot of questions on this topic. I have been through all of them but nothing seems to help. How to sort by clicking on column header? How should I modify this code to do the job? public partial class Form1 : Form { public Form1() { List<MyClass> list = new List<MyClass>(); list.Add(new ...

AcceptButton for each group of controls in different tabs, Can't use some envents in Combobox to make it AcceptButton..

I have different tabs on my UserControl. Each tab has some controls and button. I want to change AcceptButton on the basis of group of controls I am in. I can use TextChanged event or Enter event to make a button AcceptButton for Textboxes but I have some Comboboxes too. These combos are auto complete so I can't user Enter event on thes...

c# WinForm: Remove or Customize the 'Focus Rectangle' for Buttons

Is there a way to disable or better yet draw your own focus rectangle for a regular button control! (that dotted line seems so Windowss 95ish) I've noticed that the control properties (FOR BUTTONS) does not have a ownerdrawfixed setting (which I don't know if that's even the route to use for the solution, although i've seen it used for ...