datagridview

Binding a DataGridView to a DataTable but also including a ComboBox as the last column

Right now I have a DataGridView that's bound to a DataTable that works all well and good. What I need to do on the DataGridView is include a new column at the very end that is a ComboBox that will dynamically filly based on the key value of the row. My columns are ID, Name and Count. The 4th column will be a ComboBox that takes an ID a...

winforms datagridview sorting using LINQ

Hi there! Im using Linq...more specifically, PLINQO. anyway the following is an example of a query I have bound to a datagridview (winforms): public static List<Task> GetUserTasks( Guid userID ) { using (myDataContext ctx = new myDataContext()) { try { return ctx.Manager.Task.GetByUserID( userID ...

winforms Tooltip in winforms DataGridViewImageColumn

Hi again! I have the following code that successfully displays an image in its column based on its bound DataProperty: private void dgvTasks_CellFormatting( object sender, DataGridViewCellFormattingEventArgs e ) { if (dgvTasks.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.ColumnIndex == 1) { e.Value = ( (...

How to verify if a DataGridViewCheckBoxCell is Checked

Hello, I have a problem which I can't seem to solve. I have a bound a data table to a datagridview, this datatable has a column called "Status" which is of type boolean. I can set the value to true or false just fine for via code. However, I can't figure out how to check and see if the a give row is already checked or not. This is t...

Subsonic 2.2 where are the Datagridview colunms

Hi there, I'm was going to update are windows VB.net project to use Subsonic 2.2.1 from 2.0.3.0 I was testing 2.2.1 to make sure everything would update with no problems and guess What  I have most for the data grid views bind to the subsonic generated collection and I can change the columns header text, I found with the test that I c...

how to limit rows in dataGridView ?

Hi, i have a data file(csv) consisting of 2 columns & 1000 rows, as i load it to my datagridview it takes alot of time, i just want to show only the first 6 rows just as a preview of file to user. Is there any way i can show only the first 6 rows in my datagrid view. Following is the code im displaying the data in DataGridView. DataTabl...

Can't Allow User To Add Rows to DataGridView with List<> Datasource.

Hi everyone, I've DataGridView that bound to List<myClass> as DataSource. But when i set "AllowUserToAddRows" property to "True" there is nothing appear. I tried to change the DataSource to BindingList<myClass> and it's going well. I wonder if i should replace my List<> with BindingList<> or there is better solution ??. Thank you ve...

Winforms DataGridViewColumn with Image and Text

Hi there, I am asking this question here as I could not find any conclusive results thru Google. HOw would it be possible to include an image and text in the same column in a Winforms datagridview? I have the following code handling the CellPainting event, but it does not work too well if the user adjusts the height of the row. priva...

How come the getter on a property on an object fires even though no part of my form is asking for that property?

Normally a databound winform only fires the getters for the properties which match textboxes, grids etc But as I page through a collection (via BindingNavigator NextItem/PreviousItem), I'm finding that if I set a datagrid's DataSource to a property, then remove it, that property getter thereafter continues to fire even though the grid o...

Disable CTRL + Up Arrow = Home on DataGridView

When I press CTRL and Up Arrow on DataGridView I go to the first row. When I do the same with Down Arrow I go to last row in DGV. How to disable this behavior in this direction that when I will do CTRL+Up I will go one row up and when I do CTRL+Down I go one row down? ...

How to make vertical tabbing mode in datagridview in windows application c# code

I want to remove horizantal tabbing in datagridview and i want add add tabbing in the same column means vertically. If i press tab i want to move curser next row of the same column using C# code. Please help me ...

How to get DataGridViewRow from CellFormatting event?

I have a DataGridView and handle event CellFormatting. It has a parameter called: DataGridViewCellFormattingEventArgs e With e.RowIndex in it. When i do: DataGridView.Rows[e.RowIndex] I get proper row from collection. But when I click at a header of a column to sort it by other column than default one and user DataGridView.Rows...

seting datagridviewimagecolumn image layout!!!

How can i set layout style of an image cell or entire image column's image size to stretched ...

Observe event created through an instance of a Winforms UserControl

Hi! In my winforms app, I have a UserControl that contains a DataGridView. I instantiate and load this UserControl when needed into a panel in my Main Form (frmMain). My problem is figuring out how to resond to or listen for events raised in my UC's DataGridView. For example, I want to handle the CellDoubleClick event of the DataGridV...

adding an image to the header of a .net datagridview

I just need a way to insert an image into the header of a vb.net data grid view. Is there any way to do this? ...

How can i change the background color of datagridview headercell in code using C#?

I want to change the backcolor of a headercell in datagridview row .So how can i do that in code C#? ...

Informing the user that a DataGridView is being populated

I am writing a program in VB.Net to manage text messages sent through an API. It allows you to view messages in a datagridview and filter by date, sent/unsent etc... To load the messages I'm executing an SQL statement and retrieving a DataTable which then gets set as the DataSource for my DataGridView control. The problem is that depen...

Problem deleting multiple rows in an unbound datagridview

Hi: I am a programmer teaching myself C#. I have a project that reads rows from an SQL database and displays them in a datagridview. That part works great. I want to show a subset of these records by deleting every non selected row in the grid. This is the code: foreach (DataGridViewRow row in dataGridView1.Rows) { if (!row.Selected...

Selecting columns from a LINQ query

I want to be able to select the columns that are displayed in my DataGridView. I.e., I have a linq query that returns an IEnumerable but I don't want to display all the properties of Policy - I want to allow the user to choose what to display. So I thought something like this might work to create a "narrower" object with only the columns...

C# Auto Resize Form to DataGridView's size

I have a Form and a DataGridView. I populate the DataGridView at runtime, so I want to know how do I resize the Form dynamically according to the size of the DataGridView? Is there any sort of property or method? Or do I have to determine the size myself and update accordingly? ...