datagridview

inporting excel data while retaining formatting.

Is it possible to import excel data to display using C# in any view(data grid etc ..) while retaining formatting like Bold, italic and strikethrough, throughout the document. I am making a windows form application. My data is in an excel sheet , i want to display it in grid view or any other while retaining the formatting. PLZ help. ...

How do you properly override DataGridViewCheckBox.Value?

I'm trying to override a DataGridViewCheckBox so that it takes it's boolean value from whether an object is in a collection (essentially a predicate), and when the value is set it adds/removes the object from the collection as appropriate. Furthermore, I want this value to be checked when the checkbox is displayed (but I can't set Valu...

Setting a DatagridView row to have focus on Form Load

Hi, I have a dialog that containers a DataGridView, this dialog is opened from a parent Form. I would like the DataGridView to have focus as soon as the form is opened, so on pressing the down key would enable you to scroll down through the rows straight away. I have tried setting the tab index so that the DataGridView is the first s...

When user hit's the site the custom error page is shown. Why? This is to few users and sporadic.

Could somebody please help me? We are developing a asp.net application using asp.net 2.0 framework. The issue is sporadic. As soon as a particular user hits the site in production a custom error page is shown. I been told that this user could get in successfully some times and after some idle time he is getting this error page. We not ev...

Howto bind bindingnavigator to datagridview

Hi, I have a function for fetching data from a database via a dataset public DataSet getDataSet(string query) { DataSet ds = new DataSet(); OleDbDataAdapter da1 = new OleDbDataAdapter(query, sybaseconn); OleDbCommand cmd1 = new OleDbCommand(query, sybaseconn); cmd1.CommandType = CommandType.StoredProcedure; ...

where is the other partial class definition of my default.aspx.cs ?

I built an empty website on VS 2010. Using the toolbox I put a DataGridView on my default.aspx. Then I configured the sql query that fills it from the DataSource. I wanted to see the ADO code that is done under the covers. But all there is the default.aspx file, and the default.aspx.cs: public partial class _Default : System.Web.UI.Pag...

Directly manipulating a DataSet

I have a lightweight data-basey kind of thing. Functionally, I'd like to read and write tables out to disk(plus maybe some other info in the future). I chose to use the DataSet object, paired with the DataGridView control for the IO. The DataSet object can serialize out to disk and back again via the handle XML read/write functions. H...

winform - merging datagridview headers

Dear friends I have a problem with merge the datagridview headers in winForm. I using this code : void dataGridView1_Paint(object sender, PaintEventArgs e) { Rectangle r1 = dataGridView1.GetCellDisplayRectangle(2, -1, true); Rectangle r2 = dataGridView1.GetCellDisplayRectangle(3, -1, true); r1.X += 1; ...

DataGridView Checkbox Help (WinForms)

Hello, I have added a checkbox column (first column) and the table I used as a datasource contain some bool values which turns automatically into checkboxe columns. I also add an empty row so I can use the check boxes of it to do some work. I want to do the following: 1. When I check the first column Header checkbox, it will show only ...

validation in master-detail datagridview

Hi! I have two datagrids on form. Master presents people and detail their phone numbers. As data source there is two IList: IList<Person> and IList<ContactNumber>. Since the DataRelation object is out I'm using SelectionChanged event on master data grid to change display of contact numbers in details grid (I give null to details grid da...

Custom sort xml bound DataGridView

I have a DataGridView bound to xml file. I would like to sort by first column and treat values as integers (not strings). XmlDataDocument xml = new XmlDataDocument(); xml.DataSet.ReadXml("file.xml"); dataGridView.DataSource = new BindingSource(xml.DataSet, "Item"); Sort(IComparer) doesn't work Sort(DataGridViewColumn,ListSortDirecti...

DataGridView's ScrollEventType.EndScroll

How can i get ScrollEventType.EndScroll in dataGridView's Sroll event handlars mehtod. void dgvMapper_Scroll(object sender, ScrollEventArgs e) { if (e.Type == ScrollEventType.EndScroll) {} } ...

Datagridview row formatting based on data

I have a DataGridView bound to a BindingSource. Each row has three fields: Name, StartDate, EndDate. Elsewhere on my form, I have a DateTimePicker control. When the DateTimePicker's date is between a row's start and end dates, I want to highlight that row. But I cannot figure out how to do this. Can anyone give me a starting point...

How do I mimic Windows Explorer multi-select/drag-n-drop behavior in a DataGridView?

I'm trying to mimic the way Windows Explorer handles multiple selection. In a default DataGridView, you can select multiple items using Ctrl-click. But if you release the Ctrl key and then try and drag/drop the selected items, it clears the selected items and only selects the "hit" row. I found the following solution somewhere online....

DataGridView -- Simultaneous input and output -- Is this a bug in DataGridView

I have created a C# Windows Forms application which I've attempted to make as simple as possible to demonstrate a problem I am running into. I'm trying to use a DataGridView to allow user input in one column while simultaneously getting updates in another column from a background thread. The problem is that the Input column is effectiv...

Use ASP.net DataGrid with temporary table (from Stored Proc)

Hi, I have a datagrid that is bound to the results of an Stored Proc (a temp table), in code. Something like: DataView _sendTo; SqlDataSourceMatches.SelectCommand = EXEC get_matches 1, 2, 3 // The S/P returns multiple data sets DataSet ds = ((DataView)SqlDataSourceMatches.Select(DataSourceSelectArguments.Empty)).Table.DataSet; ...

Column by Column Horizontal Scrolling in the DataGridView

Has anyone succesfully gotten the DatagridView control to scroll by full columns? The vertical scrollbar scrolls by full rows so it seems like it should be a capability but I have had no luck. ...

DataGridView & Checkbox Column?

Using vb.net and DataGridView in Winforms. What even should I use to know when the checkbox has changed? ...

Find a DataGridView cell

How do I find a cell with a specific content in a DataGridView? ...

Make it possible to ONLY select one row in datagrid?

Hey guys, As the title says - I want my datagrid to only allow one single row as selected at the same time. I guess I can do this by adding code to the datagridviews selectionChanged-event, but is there a better solution? I would prefer to just have a property to set, I.E. : mydatagridview.maximumNrOfRowsSelected = 1; or something sim...