Datagrid tutorial needed.

A

Andrew Baker

Coming from VB, I find the changes needed to manipulate a datagrid are much
more taxing than previously.

Is there a good tutorial for things like:

Setting the column widths
making the grid uneditable
making the whole row highlight when selected

There are a number of posts but as I am trying to learn on my own, they are
a bit confusing.
For example,. I have found the following code to remove the updating row at
the end, but dont understand why I need a currencyManager to do this. (I
know it is C# code)

CurrencyManager cm = (CurrencyManager)dataGrid.BoundContext[
dataGrid.DataSource,
dataGrid.DataMember];

DataView theView = (DataView)cm.List;
theView.AllowNew = false;

Any help appreciated.

Thanks

Andrew Baker.
 
C

Cor

Hi Andrew,

You are a little bit confusing.
Coming from VB, I find the changes needed to manipulate a datagrid are much
more taxing than previously.

Do you want to do it with VB.net code or with C# code because you are
talking about that also?

However in general, there are lots of methods to manipulate a datagrid. For
the columnwidth and things like that I think that the best you can do is
look at the datgridstyles and datagridcolumnstyles on msdn.microsoft.com

http://msdn.microsoft.com/library/d...tml/vbconintroductiontothedatagridcontrol.asp

For manipulating rows, you can look at the underlaying layers. Mostly the
dataview or basicly the datatable. However some people like to do the
manipulating from rows using the binding and currency manager. I think that
is a matter of preference (I like the most the dataview).

One of the nicest thing from dotNet is that there is not one best method,
but you can choose the best method for your problem or your way of thinking.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top