datagridview

New autoNumber cells in dataGridView get the values -1,-2...etc

I have an access database table that has an autoNumber column, and the table is connected to a winform through a dataGridView. Now every time I add a new row, the autonumber column cell of the new row is set to -1,-2,-3...etc instead of 28,29...etc how can I fix this. Using Visual c#2008 express on XP. ...

Fill dataGridView thank's to backGroundWorker

Hi I have this code sinnpet private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { remplirDataGrid(); } private void frmChercherActesLoad(object sender, EventArgs e) { backgroundWorker1.RunWorkerAsync(); } private void remplirDataGrid() { ...

Data column resize mode setting in DataGridView (c#)

I have a DataGridView containing two columns. What I want columns to behave is, column A has a minimum width and nothing else. Column B should take up whatever space left. Users can resize column A's width freely and column B always takes up whatever space left. I was thinking to set column B's auto size mode to fill but this doesn't al...

DataGridViewCheckboxCell making new row when checked for some reason.

Hi, I have an application in VB 2008 Express that uses a DataGridView to display rows of information. I have a DataGridViewCheckboxCell on each row for selecting the row so the user can mass delete the selected rows. For some reason, whenever I try to select a row via checkbox it adds another row to the DataGridView, is there anyway to d...

Why this code doesn't work? :(

<dg:DataGrid Name="gridList" AutoGenerateColumns="False" ItemsSource="{Binding ItemsInTable}" HeadersVisibility="Column" > <dg:DataGrid.RowDetailsTemplate > <DataTemplate x:Name="ItemDetails" > <Border HorizontalAlignment="Stretch" CornerRadius="5" Background="Azure" > <Stack...

How can I change the color of a DataGridViewComboBoxCell in the CellFormatting event?

private void CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if(whatever) e.CellStyle.BackColor = SystemColors.ControlDark; This works fine for text columns but for combo box columns it makes no difference. I'd just as soon not make an owner draw control if there's a simpler way to do this. Thanks, Spike ...

UserControl in Custom DataGridViewCell Ignoring First Keystroke

I have a custom DataGridViewCell with a user-control as its editing control. The cell was built in the style of this article: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.initializeeditingcontrol.aspx For the most part, this works great. The problem is that the regular behavior of a DataGridViewCell is t...

Simple silverlight sample does not show my data on datagrid.

I have a simple program which displays a collection on a data grid. When I run the code I do not see grid displaying data. The model is public class Person { public string Name; public int Age; public bool Sex; } The view model is public class PeopleViewModel:INotifyPropertyChanged { List<Person> _personList; ...

How to add a new row to DataGridView using a button

In a C# Windows application, I'm using a DataGridView to display all the data. I want to add a new row to the grid when the user clicks the Add New Row button. How can I accomplish this? ...

Handle empty cells in DataGridView

Hello everyone. I want to write a condition for when some cells of DataGridView are null or empty. For example if cells[1] isn't null or empty , a method must be run and ... I wrote it in some way , but some of them didn't work, and one of them work but its not good solution for my problem.As you now ,empty and null are different in Data...

how to set my datagridview index value as my dataset value?.Insted of auto generated index in .net wiform.

how to set my datagridview row index value to my dataset row value?.Instead of auto generated index in .net wiforms. Example: i am binding employee details in grid.if i select a row or a cell in the grid,It will display employee id in my text box. so i need to set row index value as my employee id. ...

C# in Visual Studio: How to display a list in a DataGridView? Getting weird stuff

Hi Everybody - Been a while and I've volunteered to teach myself Windows programming at my company. Started writing vbs scripts and suddenly realized how incredibly useful this programming thing is ;-) Anyway, I'm a total newbie at C# AND Visual Studio, I kind of get how it works, you drag and drop interface pieces in the design side t...

KeyDown event - how to easily know if the key pressed is numeric?

Hello, I am currently handling the KeyDown event of a DataGridView control. One of the columns is filled by calculated values and I want the user to be able to override the cell value if they want. When the user presses a numeric key, the cell goes into EditMode and allows the user to override the value. If the key is not numeric, noth...

How can I display different values in a DataGridViewComboBoxColumn drop list than in the text box?

I have a DataGridViewComboBoxColumn where I'm supposed to display different values than are selected, much like what's going on in this question: http://stackoverflow.com/questions/1390462/datagridviewcomboboxcolumn-name-value-how In my case, I'm displaying lists of equipment which have an ID and a description. So my bound data class l...

Trying to create DataGridView from key-value pairs in C#

In a Windows Form application, I'm trying to create a DataGridView with two columns: one for the key given by an XML element and one for the value of said XML element. This is my code so far: this.myData = new DataGridView(); ((System.ComponentModel.ISupportInitialize)(myData)).BeginInit(); myData.Location = new...

How to solve this combo box issue in datagridview in .net winforms?

i had two combobox(Catogery, product) in my grid. what i want to do is. if i select category it will display some data set value based on category, and if i select product it will bind some values in that datagrid cells.like price quantity.. i don't have idea about how to write event for combo box selected index change event which is i...

Windows Forms/DatagridView Screen Flickering

Has anyone experienced a case where a .Net Windows Forms app caused severe desktop flicker? I have a Windows Forms app (.Net 3.5 , C#) with a datagridview in a usercontrol. Occasionally, while running other applications at the same time (I see it with Louts Notes, but the worst behavior is a user with Reuters Bridge Station) , switchin...

What I can use instead of GridView?

What I can use instead of gridview or how can I speed up loading? How to build something like stackoverflow using for showing data? Is anyone has example with code source? ...

SQL data in DataGridView

Hey guys, I have an application that I want to display some data from a sql db in a DataGridView... I have the data displayed in the DataGridView now but here are my questions... How can I use custom header titles because I don't want the SQL column titles to be used for the DataGridView column titles. Also, I want it so that when a user...

Hide a Group Name in wpf data grid

I've got two groups in my datagrid. First one is the main group and the second is the subgroup, what I want to do is hide the Main group and just show the subgroups in my data grid. Here is the code: ListCollectionView collection = new ListCollectionView(bdata); collection.GroupDescriptions.Add(new PropertyGroupDescription("tid"));// I ...