datagridview

Bug in my datagridview EditingControlShowing handler (.NET)

I have a DataGridView and a handler for the EditingControlShowing event which is used to add or remove handlers for the keyUp event for some columns. The problem is sometimes a column which does not have an associated KeyUp handler actually fires the handler. It seems like the grid does not know which column is supposed to fire which ha...

DataGridView.DataSource does not have new row from the grid (.NET)

I have a datagridview which is initially bound to an empty datatable. Then the first row is populated by setting values to the columns of the grid's CurrentRow.DataBoundItem row. I enter a new row manually by typing values in the last blank row. I hit a save button which does: DataTable dt = (DataTable)MyGrid.DataSource....... I noticed...

.net 2.0 datagrid view combobox windows application

I have a data grid, a new row is added when i click on button. the new row consists of dropdowns in each cell. the value of the next cell dropdown must be based on the first cell drop down and so on for the third cell. I am using a .net 2.0 windows application in c# ...

Remember selected row in DataGridView

I'm trying to get my datagridview control to remember the selected row after data refresh. The DGV is databound to a list of business objects: Dim FXs As SortableBindingList(Of FX) = FX.LoadAllForBinding(FXStatus) Dim bs As New BindingSource bs.DataSource = FXs The overall sequence is something like this: User clicks on a row Row i...

Returning XML From a WCF Service

I am creating a WCF Web Service in which one method (exposed in Service) return data in XML format as given below: public string QueryDirectoryEntry() { XmlDocument doc = new XmlDocument(); doc.Load(@"c:\" + FILE_NAME); return doc.InnerXml; } If the client call this method ther service return data ...

C# dynamically taking data from DataGridView

I'm trying to get my current program to take information from a dynamically created DataGridView. I have managed to get the information into the grid, and perform the required search, however now I'm really stuck. I have added a column to the datagridview which holds a button within each row. What I'd like to do is take the value of the...

How to rebind datagridview when user moves from one cell to another?

I have a datagridview where the first cell is used to retrieve data for the grid. If I use the cellleave event to rebind the grid to a datatable, I get a "Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.", which makes sense. Where can I bind the grid to a datasource after all the e...

Editing DataGridView cells without a bound source?

Hi all, New to .NET/C# stuff so please forgive me if it's something obvious ;-) I'm trying to get cell editing going on a DataGridView control (WinForms). I've set all "ReadOnly"-type options to false, I've set EditMode to "EditOnEnter", I've added a row and selected a current cell programmatically, I've tried calling BeginEdit() but a...

WPF DataGrid - Button in a column, getting the row from which it came on the Click event handler

Hi, I've set the itemsource of my WPF Datagrid to a List of Objects returned from my DAL. I've also added an extra column which contains a button, the xaml is below. <toolkit:DataGridTemplateColumn MinWidth="100" Header="View"> <toolkit:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Click="Button_C...

Datagridview on RowLeave not assigning proper values to booleans

I have a DataViewGrid I populated from a DataTable in a query to a DB. While trying to capture the Row_Leave event, so I could properly update it, I can't seem to capture the latest value in boolean columns. If I update just a text field, when I access the underlying DataSource I get the latest value I entered, buy if I access the boole...

C#/Winforms: sorting a datagridview by a column that is not part of the DataSource

I have a datagridview that has its datasource linked to a databinding from a database. All the columns are sortable by doubleclicking the header. Now I added one extra column by hand that just contains numbers. Strangely I cannot sort the datagridview by this column. If I doubleclick the header nothing happens. I have set sortmode to...

Linq to sql, filtering results in a datagridview

Hi all, I have a very simple database for which I'm using linq to sql. I have a datagridview to show the contents of the table. I want the user to be able to filter the rows appearing in the datagridview, if possible without making another query to the database (I'm really low on resources, so the solution has to be as fast as possible)...

.Net DataGridViews Bound to Same Binding Source in Different Tab Pages

I have a winform (C# VS2008 .net 3.5) with a Tab Control. Two of the pages on the tab control have Data Grid Views bound to the same Binding Source. This works fine. However, there is a bug with Tab Pages in that Data Grid Views held in Tab Pages always show the first column of the bound table, whether or not it is set to visible at d...

DatagridView loses current edit on Background update

Here's my problem : I have a DataGridView bound to a BindingList of custom objects. A background thread is constantly updating a value of these objects. The udpates are showing correctly, and everything is fine except for one thing - If you try to edit a different field while the background-updated field is being updated, it loses the e...

Unable to format date in dataset column,GridView

Hi , I am reading data from an excel sheet and displaying it in a data gridview.There are some date columns in the excel.So when i read the data from the excel and bind it to the dataGridView.The date is displayed in the format "02/02/2009 12:00:00 AM" but the actual data in the excel column is in the format "2/2/2009".So how to ...

Access the Item bound to a DataGridView Row (WinForms)

How would I access the bound item for a specific row for a DataGridView bound to a Custom Collection? ...

Child DataGridView inside a DataGridView

I have a data collection that holds a list of companies' data. Some companies have more than one office. I want to use windows form's datagridview to represent the data like this: |--Company Name--|--Company ID--|--Company Address--| | Alpha | 001 | 1 Alpha road | |--Office Name---|--Office Address--...

Update Binding Dataset if User Deletes a Row from the DataGridView in vb.NET

VS 2008 in vb.NET Hi, I have a manually created a dataset (dsPickingList) that I add data too as the user inputs data on a form. There is a datagridview on my form of which it's datasource is set to dsPickingList. What I would like to do is spot if a user deleteds a row from the datagridview and update the dataset (dsPickingList) as i...

C# Exception when retrieving rows from a datagrid in virtual mode

Hi all, I keep getting an exception (see below) when I retrieve a list of rows from a Virtual Mode datagrid, this only happens when I have more rows than I can display on screen and it doesn't happen every time. Is there anything I'm missing with regards to virtual mode? Update> The image below shows the problem, the index is now outs...

DataGridView AutoGenerateColumns is set to true somehow

Hello, I derive DataGridViewEx class from DataGridView like this: public class DataGridViewEx : DataGridView { // ... [DefaultValue(false)] [Browsable(true)] public new bool AutoGenerateColumns { get { return base.AutoGenerateColumns; } set { base.AutoGenerateColumns = value; } } public DataGridViewEx() { AutoGenerateCo...