datagridview

Editable Column headers for WinForms DataGrid Control?

Hi all, I'd like to display a DataGrid control where the column headers are editable by the user. Is this possible? ...

Performance issue on the update of a DataTable bound to a Datagridview

I have a dataTable bound to a DatagrindView and would like to update a selected column. My DataTable(displayDT) and my datagridview1 have the same layout: DateTime item1 item2 item3 1/1/2010 100 100 100 1/1/2010 1:00 120 110...

Trying to load a list into a DataGridView Cell

I'm trying to display an object into a DataGridView using Reflection so far everything works smootly but the problem is that some of the object's properties are Lists. How can I adapt my DataGridView to show a list? public void SetDataSource(PluginBase plugin) { dgvProperties.Rows.Clear(); List<DataGridViewRow> rows = new List<...

DataGridView - how to hide the "new" row?

My DataGridView is read-only - the user cannot enter data into it, so that empty row at the end (the "new" row?) just looks ugly. How can I prevent it from displaying? ...

c# controlling datagridview columns drag and drop operation

Hi I have a datagridview table and I want to disable drag and drop in some specific situations. Example: I have 4 columns named A,B,C,D. I divide them in to 2 groups: A,B and C,D (for a user they look like 4 normal columns). Now when the user drags a column A or B, he can only drop it before C. When he drags C or D, he can only drop ...

Spreading the contents of a DataTable into 3 DataGridViews

Hello, Let's say that I have a form which runs a stored procedure. This stored procedure creates some rows in a table with pre-generated values and returns me a DataTable containing the rows created by this stored procedure. On the form, I need to display this information on 3 different DataGridViews, so the user can change it. The sch...

DataGridView: Format values without actually changing the bounded data?

Hello I've been searching through the web but I have not been able to find an answer. I have a DataGridView with a BindingSource bounded, which has a List of objects of a custom class. Among the fields of the class, I have a string field which I want to show using Path.GetFileName(); because it contains the whole filepath and what I...

How to implement and bind crosstab data using Entity Framework/Winforms?

Hi, I want to keep some timesries data in my database. Raw data are something like below: Time Col1 Col2 Col3 8:00 12 18 20 8:30 14 12 13 9:00 17 15 14 Where number of columns and time steps are undetermined. So I created three tables like this: TimeStamp(ID,Time) Columns(ID,Name) Values(ID,TimeStampID,Colum...

.net gridview record count

Hi IM sure there's an easy way round this.... If I populate a gridview by eg, selecting a value from a dropdown list, then I want to show the total number of records in that gridview, i have a textbox which i set to lbTotal.Text = Convert.ToString(gridview.Rows.Count); Problem is, is only shows the total for what was previously ...

Direct access to DataGridView combobox in one click?

Hi, I'm getting annoyed with clicking once to select a row in the datagridview, and then clicking again to click on a control in that row (in this case a combobox). Is there a way configure this thing so that all this can be done in one mouse click instead of two? ...

Highlight Part of a text in a cell of datagridview

Hi. How can i Highlight Part of a text in a cell of datagridview ? I am using C#. Part of text. for example user searched book. on of cells contains bookmark. i want to highlight "book" in bookmark. thanks. Edition. Does it code ok? Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGr...

Update datagridview row from a thread in c#

I have a datagridview on a windows form application. Application post all displayed data to an external website. website return codes so application detrmine status of posted data. I need to create a parametrized thread that take row index as parameter and post the row data and update it by return value. (It may involve changing row b...

DataGridView fill with ODBC connection

Hi GUys, I want to fill my DataGridView from database using ODBC connection. How can I achieve this? string userName = ConfigurationSettings.AppSettings["userName"]; string password = ConfigurationSettings.AppSettings["password"]; string connectionString = userName + password; OdbcConnection odbcConnect...

How to handle shift+back in a derived datagridview?

Does anyone know how to handle shift+back in a derived datagridview? I can catch shift+enter in processdatagridviewkey and shift in processdialogkey but never shift+back. Thanks, Adam ...

Model-View-Presenter and Transferring Large Objects

I have traditionally implemented a Model-View-Presenter [Passive View] like so: interface IView { string Title {set;} } class frmTextBox : Form, IView { ... public string Title { set { this.txtTitle.Text = value; } } ... } class frmLabel : Form, IView { ... public string Title { set { this.lblTitle.Text = value; } } ... } class Pres...

c# datagridview adds rows after rejectchanges

I'm adding a new row to DGV DataGridGeneral, that is bound to BindingSourceGeneral. BindingSourceGeneral_CurrentItemChanged is run to save the row in the db. I try to launch RejectChanges() in case of error. BindingSource rejects the row properly, DGV rejects data, but 2!!! more rows appears in it! The coding: private void BindingSource...

Set Binding Source DataSource to Generic IList<> Error

If I want to set the DataSource property on a BindingSource to an IList<>, do I need an explicit cast as the following error message says or am I doing something wrong? interface IView { IList<OrderItems> BindingSource { get; set;} } public partial class Form1 : Form, IView { public Form1() {...

DataGridViewComboBox null values

I have a Windows forms DataGridView with a combobox column. The combo box column is bound to a data source that is populated from a Linq to Entities query. I would like users to be able to select "Nothing" in the combo box (assign a value of NULL to the underlying data source). How can I accomplish this? ...

CellValueChanged vs CellValidating Events for DataGridView

Hello, What's the best place to implement validation logic code and conditional formatting code for a DataGridView? In a lot of books and articles that I've read on this control, it seems to suggest that the appropriate event to handle for this is the CellValidating one. Well, the name more than implies this as well. However, this eve...

Scroll bar greyed out when a Data Grid View is updated but not visable.

I have a custom control that is basically a DataGridView docked inside a split panel with a rich text box on the other half. This control is docked in a tab page in my main program. Here is some relevent code public LogReader() { InitializeComponent(); using (var conn = new SqlConnection(ConnectionString)) using (var ada ...