datagridview

VB Getting Object from DataGridView Row

First off, I found a similar question here, but don't understand how it works, and I'm not comfortable 'bumping' or replying to a couple month old question. I have a datagridview control and it's DataSource property is set to a List type object. Question: I'm trying to figure out how to reference the actual object of a selected row so ...

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 ...

Load rows as needed in DataGridView

I have a WinForm DataGridView bound to a List<> of objects and I would like to set the datasource of the DataGridView to display only so many records at a time. From a few searches it looks like there is a way to do this however I have not found the exact method. Is there a way to set the total row count and then set an event that fires...

How to remove the edit line at the bottom of a DataGridView?

I am using a DataGridView in a UI because of how easy it is to bind to a source like a DataTable. The only problem i have is that it is intended to be read only and therefore i don't need the edit line that always shows up at the bottom of the grid rows. I have looked around and can't see a way to turn it off. Dose anyone know of a way t...

Custom NumberFormatInfo on DataFormatString

Hi All I have an ASP.NET Gridview with a BoundField that is bound to a decimal value. I use the following code to format the decimal number to a currency value: DataFormatString="{0:C}" We have a custom implementation of NumberFormatInfo though, which removes the currency symbol and modifies the thousands seperator. Normally this for...

WPF DataGridTemplateColumn. Am I missing something?

<data:DataGridTemplateColumn Header="Name"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Name}"> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> <data:DataGridTemplateColumn.CellEditingTemplate> <DataTempla...

.NET / C# Binding IList<string> to a DataGridView

I have an IList<string> returning from a function (as variable lst) and I set and then I this.dataGridView1.DataSource = lst; The datagrid adds one column labelled Length and then lists the length of each string. How do I make it just list the strings? ...

search for winforms datagridview

I'm looking to implement a search box for a datagridview control similar to let's say firefox Control-F which would bring up a search box and on finding a match the row would be highligted etc. Is there any similar functionality perhaps using Lucene.net or similar ? Note - this would be different than say DataTable.Search() as the # of...

Preventing a DataGridView from selecting the first item

I have a WinForm DataGridView that when I populate it with data the first item is selected by default. I don't want this to occur as to when an item is selected an event fires and some code is executed. Solutions I have for this is to unhook-bind-rehook the event or have a flag that is changed the first time the event fires after a new...

How to Import Excel to Datagrid without OleDB?

Hello, my application is 64bit native, therefore the examples on how to import an excel file to a gridview, are useless, due to the OleDB drivers been 32bit only... is there a way around, on how to import an excel file to a datagrid without using the OleDB connection? ...

WPF DataGrid how to get when ItemsSource updates

Which event fires when DataGrid's source is updating? I've tried DataContextChanged and SourceUpdated but it never worked out. Actually I need a simple thing. I want, if there is a new row comes, scroll the GridView's scrollbar down to the bottom to see what it was. ...

How can I hide the drop-down arrow of a DataGridViewComboBoxColumn like Visual Studio Properties window?

I have a DataGridView where one of the columns is a DataGridViewComboBoxColumn. When the grid is populated, that column looks different because of the drop-down arrow appearing on each cell in the column. I'd like to change this so that the drop-down arrow is hidden and only shows up when the row is actually highlighted or when the combo...

Copy DataGridView contents to clipboard

Hi I want to copy the contents of a DataGridView and paste in in Excel. I tried myDataGrid.SelectAll(); DataObject dataObj = myDataGrid.GetClipboardContent(); Clipboard.SetDataObject(dataObj, true) But this just pastes nothing Any suggestions? Thanks ...

Set RowTemplate DividerHeight in DataGridView when using AutoSizeRowsMode

Hi, I'm using a DataGridView in a WinForms project with the AutoSizeRowsMode set to "AllCells". I would like to increase the space between rows, but setting the DividerHeight in the RowTemplate has no effect. Does anyone know how to increase the space between rows when the AutoSizeRowsMode is a value other than "None"? Thanks! ...

Why isn't my datagrid updating?

I have an object that has as one of its properties, a List. I want to bind a datagrid to that list, such that when I add objects to the grid, the datagrid updates. I tried: myDataGrid.DataSource = myObject.MyList; but when I update the datasource with new rows, the grid doesn't update. Then I tried: myDataGrid.DataSource = null; m...

how to set focus to the new row in datagridview - vb.net

i donno how to set focus point always to the new row in datagridview in the beginning?? ...

multiple grid form layout

Hello: I have a time sheet type of presentation, which is currently using three (3) datagridview controls on a winform as follows: 1) projectGrid - rows are variable, with one for however many projects were worked on that week (typical is 1 to 5 for most users). 2) nonProjectGrid - four rows of fixed activities one can record time spe...

Windowsforms: How to draw lines/bars on a DataGridView?

I'm using a DataGridView in a Windows application (.NET 3.5) showing some colored bars (basically "tasks in time"): What I need now is, to show a custom graphical "completed" bar on the cells depending on a percentage value. Here is a photoshopped image: Any hint how I could approach the problem or a creative solution? Thanks! Ed...

C# Datagridview - Convert TextColumn to ComboBoxColumn

Hello! I have a windows forms application containing a datagridview control. The datagridview is populated by the contents of an xml file. At the moment, all of the columns are displayed as datagridviewtextboxcolumns. I want to select one that is populated by a particular xml tag and display it's content in a datagridviewcomboboxcolumn a...

C# Datagridview - Turn off AutoGenerateColumns when binding to XML file?

I am binding an XML file to a DataGridView. I don't want the columns to be auto-generated, in fact I want to generate them myself. Is there a way of turning off the auto generating columns feature and be able to programmatically create the columns myself? ...