winforms

editing and updating data in datagridview with Windows Forms Application

I have added a datasource and a datagridview in a windows forms application. I am able to view the data from my database on to the grid, however when i try to insert new row (by clicking on the empty row) or try to edit the existing data it doesn't reflect in my database. I remember we do not have to add any manual code to achieve such a...

WinForms - Activity Indicator

In a WinForms application, I want to provide visual feedback that a looping background procedure is ongoing (It isn't something that is initiated by the user or blocks them from using the UI) Edit - It is going on all the time, looped. The user doesn't need to know when an iteration starts or finishes. I'm thinking some kind of small, ...

unable to add new row using datagridview using C# in Winforms

i wanted to make a simple data entry application. So i did the following Created a new Windows Form Application Added a DataGridView Added a new DataSource (SQL Express Database, having a single table with 3 columns - id, name, number) id is integer and is the primary key As the designer automatically populates the DataSet, BindingSour...

How do I programmatically disconnect an OpenVPN connection?

I am creating a WinForms application to start and stop an OpenVPN connection on Windows. I am trying to achieve the same functionality as OpenVPN GUI for Windows (http://openvpn.se/) provides but using my own .NET based UI. I am starting the connection using the following approach: Process openVpnProcess = new Process(); openVpnProcess...

Restrict .NET Remote Debugger Port

I have a .net 2.0 WinForms application that uses .net remoting to connect to a server in our DMZ. That side of it is running fine, but I want to debug the services I've installed on that machine. I can get everything set up fine, but as soon as I have to restart Visual Studio 2008, the port used to connect back to my machine changes, and...

Why isn't my app getting mouse wheel tilt messages?

In this question How to detect mouse wheel tilt an answer is posted and accepted that shows the code needed. I've implemented that code in my application's existing WndProc method (which is working for other messages I need to trap) but it's not working. I've checked and WndProc doesn't appear to be getting any messages at all let alone...

How can i put just the date from a dateTimePicker into a variable?

Hi, I’m using C# and WinForms to try and put just the date from a dateTimePicker into a variable. But I keep getting the date and the time. In the example below textBox1 shows what I’m looking for. But I can’t figure out how to do the same for textBox2. Where it gives the date and time. This isn’t the exact code I’m using in my app, but ...

Why ComboBox hides cursor when DroppedDown is set?

Let's create WinForms Application (I have Visual Studio 2008 running on Windows Vista, but it seems that described situation takes place almost everywhere from Win98 to Vista, on native or managed code). Write such code: using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApplication1 { public cla...

Weird error printing PrintDocument object in .NET

I have a Winforms application that generates its own PrintDocument object for printing. It works fine in XP and Windows 7 with my own testing, but one user has been getting the following exception in Vista when they select the print command with an open document: ************** Exception Text ************** System.ArgumentException: Han...

Using Variables in a fill query in a TableAdapter

Hi, I’m using C# and Winforms. I’m trying to make a report that gives a list of people that need to renew their memberships if they expire within a user supplied date range. I've got a connection to an Access file, and I'm trying to set up a fill query for a TableAdapter, and I can’t figure out how to put a variable in my "WHERE" clause....

WinForms DataGridView Question

Situation I have 3 Interface defined as follows. public interface IA { long ID { get; set; } } public interface IB : IA { string Name { get; set; } } public interface IC : IB { string City { get; set; } } Then I have a class called SampleClass that implements IC and in that class, I have a method called GetData() which returns List<...

Form.visible must be true to read .left and .top?

I create a bunch of forms, and I want to save and restore their position on application close/startup. However, if the form is not visible, then the .top and .left are both 0. Only when it's visible are these properties populated with their 'real' values. Right now my kludge is to show each form, save the info, then return it to its p...

How to set a Wpf Window as the Owner of a Winforms Form

How to set a System.Windows.Window as the Owner of a System.Windows.Forms.Form? After I searched for this for a while only to realize that I already have the answer in one of my utils classes I decided to put the answer on stackoverflow. Hopefully someone finds this useful. ...

Create and Display 'File Copy' like Animation

Hi, I've searched around quite a bit on the Internet and I'm now pulling my hair out. I reckon this should be relatively simple. I'm sure I'm not the first person to want to do this. Here's what I want to do: I want to 'compile' a custom animation, from still images, and save it as an avi, or some other [animation] file format. As...

C# Winforms Suppress a Mouse Click event on a Text Box

I have a multi-line text box on a Winforms app that I want to be able to click on in some states of the app without changing the Text selection. I still want to subscribe to the MouseDown (or Click) event, I just don't want the text selection to react to it. I was hoping for a Handled or Cancel property on the MouseEventArgs, but sadl...

Difference between OnLoad method and Load event?

Hi, What is the difference between OnLoad method and Load event? I am developing WinForm controls. Should I register to Load event or override the OnLoad method? What are the advantages and the disadvantages of each one? Thank you. ...

tabbed page

i have designed a tabbed page. im able to load forms in the tabs and even im able to navigate thru the child forms.but the problem here is im not able to load the directly,i had to write the code to load the form in tabPage1_Click(object sender, EventArgs e) event. Is there any way to load the form directly that is while opening the gui ...

How can I change the extension of the file name in a SaveFileDialog when the user changes the filter?

We have an SaveFileDialog in our application, which offers a variety of formats the user can export media in. We determine the user's choice of format using the FilterIndex property of the SaveFileDialog. The various formats have different file extensions, so we would like the file name that the user has entered to change extension whe...

Choosing the fonts for windows forms application

Hi, I'm trying to design a windows form application. By default, .NET had put Tahome 8,25 on toolbar and Microsoft SansSerif 8,25 on everything else. To improve general look and feel of the forms I'd like to change them. Which font family should I use as a default? And what size should they be? For: Classic data input form (label + te...

How do you stop DataGridView calling IDataErrorInfo.this[string columnName] get?

I have a data object that implements IDataErrorInfo however the validation logic is a bit slow. Not that slow, but slow enough you don't want to call it a large number of times. In my application a list of these objects gets displayed in a DataGridView control. The grid is read-only and will only ever contain valid data objects, however ...