winforms

C# skip checkbox listView

I have a listView that lists a bunch of files, and a set of checkboxes that allow users to download them from an FTP server, like so: Filename Size Last modified New version [ ] someimage.jpg 120 kB 2010-01-13 16:12:59 Yes [ ] otherfile.zip 12 kB 2009-12-29 09:33:15 No [ ] folder - - ...

OnClick event in WinForms DataGridView

Hi everyone, I am using DataGridView in WinForms and by this piece of code I am assigning it columns and values dataGrid.DataSource = sourceObject; only by this line all the columns and values into the grid. How do I handle the onClick event of a specific row or field. I want to do edit a particular item in the grid but I cannot fi...

Windows Forms Binding Problem: How to know if user has changed a value

I currently have a windows form application composed of a textbox and two buttons (previous and next) The textbox is bound to the name of a Person on a list. Previous and Next button changes the position of the BindingManager by 1 (either increment or decrement). using System; using System.Collections.Generic; using System.ComponentMo...

ICustomTypeDescriptor for simulating strong-typing

I thought about simulating strong-typing for key-value configuration of a new project by providing fake property info via implementing ICustomTypeDescriptor. The configuration instance should provide all default config keys as properties with default values however: I noticed that VS08 intellisense doesn't include "faked" properties whi...

When is an app.config created, when an app.exe.config and what is the difference

We have created a WinForms application and store some configurations via the ConfigurationManager class. In order to store the information I use Configuration pConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); pConfig.AppSettings.Settings.Add("updates", szUpdatesURL); pConfig.Save(ConfigurationSaveMode.Mo...

How to deploy a windows form application including database to another PC?

All I have built a windows form application using VS 2005 Standard edition which uses SQL Express as the database. I'd now like to deploy my application to another PC that has .NET framework and SQL Server already installed. The bit I am unclear about is what do I need to do to ensure that my database is also deployed with my applicat...

Prevent Multiple Form Instances

How do I prevent Multiple forms from opening? I do .show on the form but the user can click the main form and the button again and another instance of form opens. ...

Writing AxShockwaveFlash Flash Object to File C#

hi guys, i was wonder if there is any way one can read-write (or save/load) AxShockwaveFlash Flash Object to a (binary/text)file? I have a Winform with AxShockwaveFlash Flash Object on it and want it to be save to a file ,but serialization doesnt not work as type AxShockwaveFlash is not marked for Serialization? (Basically trying...

Set cell width of a Datagrid in a c# windows application

I have a datagrid in my c# windows application and my code is private void BindGrid(SmsPdu pdu) { DataRow dr=dt.NewRow(); SmsDeliverPdu data = (SmsDeliverPdu)pdu; dr[0]=data.OriginatingAddress.ToString(); dr[1]=data.SCTimestamp.ToString(); dr[2]=data.UserDataText; dt.Rows.Add(dr); dataGrid1.DataSource=dt; } An...

Dynamically assign a column width to a winforms datagrid?

I ve created columns of my datagrid using this, private void Receive_Load(object sender, System.EventArgs e) { dt.Columns.Add("Sender",typeof(string)); dt.Columns.Add("Time",typeof(string)); dt.Columns.Add("Message",typeof(string)); } How can i dynamically assign a column width to a winforms datagri...

Windows Forms combobox.SelectedItem, C#

I have two forms, a combobox is populated on both forms with this code - **departmentCodeComboBox.Items.Add(""); foreach (var dept in Departments.GetDepartmentList()) { departmentCodeComboBox.Items.Add(dept); }** When a user clicks the edit button, I want to set the selected item on from2 based...

can datagrid columns can be adjusted in c# windows application

hai how can we Adjust the column widths based on the displayed values in a datagrid in c# windows application?. ...

WinForms UserControl Layout Autosize Problems

A while back, I posted this question about trying to get a flowlayoutpanel to autosize properly when docked to the top of a container. What I was trying accomplish was to setup a horizontal (left-to-right) flowlayoutpanel spanning across the top edge of a form, and a datagridview taking up the rest of the available space below the flowl...

Storing dynamically generated data in user settings

I have a panel to which button controls are added in runtime. The panel and all its contents should be saved in the user settings (Properties.Settings.Default.MyPanel). However, while the settings object does accept strings, ints, etc. as input and stores it correctly when calling the Settings.Default.Save() method, it doesn't when I'm s...

create a textbox that accepts only numeric values. Problem with designer mode

i have a form that has some six - seven text boxes. few text boxes needs to accept only numeric chars i.e from 0-9, a decimal poing and + or - i handled the textbox key press event private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e...

When should I use a datagrid and when should I use a datagridview?

MSDN says, The DataGridView control is a new control that replaces the DataGrid control in .NET Framework 3.5. In any project in VS2008, there is no datagrid control listed in the tool box and only gridview control is present. The MSDN page also describes all the features that gridview provides and datagrid doesnt - Can anyone tell me i...

C#: Anchored Panel won't resize properly

Hi, I've a strange problem regarding auto sizing of a panel in a user control. This panel is anchored to all 4 sides of the user control. But the anchoring not always works as it should: If the user control is resized by resizing the form, the right and bottom anchors don't work. But if the control is resized by using a splitter which ...

DataBinding: Validate before change

[.NET 2] Situation: class MyObject { string Max { get{...}; set{...}; } string Min { get{...}; set{...}; } } MyObject myObj1 = new MyObject(); // ... code txtMin.DataBindings.Add("Text", myObj1, "Min"); txtMax.DataBindings.Add("Text", myObj1, "Max"); Problem: Need verifying Min < Max bef...

Intercepting Dialog Window Activate message by Owner Window

Hi, we are using c# NativeWindow and overriding WndProc method to intercept the widow messages. Is it possible for a owner window(NativeWindow) to know when its child window(dialog window) gets activated when user presses alt+tab or click on the window in task ...

Custom properties on a win32 window

I've heard (well read, at http://www.ddj.com/windows/184416861), that it's possible to set custom properties on a Win32 window. The trouble is, the download for the article above is on an ftp server that won't let me in. As a bit of background info, I have a .NET app. The main window is registered to handle custom window messages. Fro...