datagridview

is it possible to have a datagridview automatically update when the database it is bound to gets updated?

I have a C# winforms application that has a single datagridview to display the contents of a table in a mySQL database. Is it possible to have the datagridview reflect changes to the database in real time? i.e. when i make a change to the table directly, it will show that change in the datagridview ...

LINQ2SQL: how to delete entity by retrieving it from datagridview?

Hi2all! I have a datagridview and attached list of Employees to it, somthing like this: IQueryable<Employee> data = (from em in db.Employees where em.StationID == stationID select em); dgvView.DataSource = data; Now I want to delete specific Employee by selected row in datagri...

How can i find out the Last row in a datagridview and write it to text file

I would like to find the last row of the datagridview and i would like to write that particular row data to a text file can any one help me ...

how I can show the sum of in a datagridview column?

I need to show the sum of the count column from this datagridview, but I don't know how I can get to the data in the datagridview. When I click on the button, I want to show 94 in label1. How can this be done? ...

BindingList<T> datasource for DataGridView

I have a BindingList that I would like to use for a datasource on a DataGrid view. I added dataGridView1 and button 1 to a form. When I press the button, nothing shows up on the dataGridView. If I use a DataTable for the data source it works fine. I must be missing something simple. public partial class Form1 : Form { BindingList<...

When i change the datasource on My datagrid the columns dont autofill unless i order a column

I have a DataGrid on a Win Form that display perfectly when I initially set the datasource. The AutoSizeColumnsMode is "DisplayCells". When I change the datasource during runtime the rows do not autosize unless I re-order a column. Does anyone know how to fix this? Also note that the DataGrid is on a different Tab than the button that ca...

Remove columns in gridview

How do you remove this: ...

DataGridView Row select without RowHeaders

How do you select the whole DataGridView row on cell select and disabling the selection of a single cell NOTE: just like the behavior of a listview ...

Winforms: Change Datagridview image on mouseover

I'm having trouble changing the image in a DataGridViewImageCell on mouseover. According to a few sources it should be as simple as changing the value of the cell to the desired image. However, nothing seems to happen when I try this. Here is the code: private void dgvThingProgramsOnPlace_CellMouseEnter(object sender, DataGridViewCellEv...

How can I get notified in C# WinForms of external MS Access database updates?

I have a DataGridView that displays data from a MS Access database. I'm using a DataSet with a TableAdapter and a BindingSource to link the data to the DataGridView: tableAdapter = new AccountsTableAdapter(); dataTable = new Accounts.AccountsDataTable(); tableAdapter.Fill(dataTable); tableBindingSource ...

Visual Studio 2010 - C# - dataGridView save changes

I have C# Window Forms project and MySQL ODBC connector to localhost server with all privileges. I also succeeded to fill dataGridView with data, but the changes I make are not stored back to the database. How do I create save button? ...

DataGridView Winform c#

hi, every time, i press btnAgregar, add "productos" to list. only the first time the gridview show the first record of the list after the list grows, but the datagridview don't refrash, showing only the first record. List<Entidades.Productos> ProductosVenta = new List<Productos>(); private void btnAgregar_Click(object sender, Even...

Getting exception inside datagridview looping.

Hi all expert, I have two fields in data grid one comboxbox type another is texbox type. As per user selection I want to add multiple record at a time in backend. Here is my looping code…pls somebody help………help…help………me..inside looping code I am getting casting exceptions. Unable to cast object of type 'System.String' to type 'Create...

How to find a row exists in datagridview and append it to the last row of the datagridview

Hi all, I am having a gridview that will have 2 rows with some data as follows 101 111111111 1111111111009270754A094101// My first row data 9000002 1000000020222222236000000000000000000000012000000000000000000000000000000000000000//My 2nd row data I will add some values such that it should be inserted between these...

C#: How to Display Binding Data with DataGridViewComboBoxColumn in DataGridView

I don't think it's a difficult problem. but I just cannot find / google the answer. Please help. Basically, my app helps the users to find a list of words (from a bunch of files), and the list of lists of files containing these words. Say I have: public class WordInfo { public string Word { get; set; } public List<string> File...

C# DatagridView Select last row

I have some trouble with setting the last row in my datagridview selected. I select the last row this way: if (grid.Rows.Count > 0) { try { grid.Rows[grid.Rows.Count - 1].Selected = true; grid.CurrentCell = grid.Rows[grid.Rows.Count - 1].Cells[1] } catch (IndexOutOfRangeException) { } catch (Argum...

gui implementation approach in c# and .NET

Hi, I am a complete begginer in C# and .NET. I am supposed to implement a GUI for a back-end process in C#. The design I am required to follow, is to have a datagrid to display the data and as users click on rows, other representations appear.E.g. a graph of the data. The gui is managed by a process, e.g. ProcessA. Another process, e.g....

Populate DataSet from text file

Hi, I have text file with log information from another program and it has very bad formatting but I can´t edit original program and I want create a new program with dataGridView which read data from .txt file and add it to datagridview. It´s not so hard and I made it with dataGridView1.Rows.Add and array of strings (and prepared columns ...

How to replace a data from a file if already exists and write a new data

Hi all i write a code to write my last row of datagrid view to a file as follows private void Save_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count > 0) { List<string> lstContent = new List<string>(); foreach (DataGridViewRow row in dataGridView1.Rows) { ...

Datagridview combobox business object updating reference

Hello, I recently asked this question on here and got the answer. However I'm now trying to apply the same logic on a DataGridView which is bound to a BindingList< T > of Curriculum objects. The Curriculum class has a property of type Year. I'm trying to use a ComboBoxColumn to update the reference the curriculum object has of years. T...