Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2006

Tip: Looking for answers? Try searching our database.

DataGridView questions.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin Burton - 23 Jun 2006 15:07 GMT
I have a few DataGridView questions that hopefully someone will be able to
help me with some or all of them.

1) I have a DataGridView that is bound to a DataTable (DataSource set to a
table). When I progromatically add a row to the DataTable the DataGridView is
updated as it should be. The problem comes with editing. I have marked some
of the columns in the designer as ReadOnly = False, but for some reason I am
not able to edit the new added row. I look at the property in the debugger
and it is still ReadOnly = False but I still cannot edit the cell for the
column that I marked ReadOnly = False. I saw in the documentation that the
ReadOnly attribute for the row takes precedence over the column attribute.
Maybe this is what is happening? How do I set the ReadOnly property for the
row? Or more precisely how do I enable one or more columns for editting?

2) I handle a CellFormatting event and change certain columns display value
to a proper currency format. Now I would like to change the alignment so the
decimal points line up. It seems that the default alignment is to the left.
How do I change the alignment of the values in a column to be right-aligned?

Thank you.

Kevin
Kevin Burton - 23 Jun 2006 22:35 GMT
For the first question I checked the columns that the DataGridView is bound
to for example:

               
_dsManualOrder.dtManualOrderItemDiscount.Columns("quantity").ReadOnly

And this ReadOnly property is False. Something else is preventing me from
editing.

Kevin

> I have a few DataGridView questions that hopefully someone will be able to
> help me with some or all of them.
[quoted text clipped - 18 lines]
>
> Kevin
Kevin Burton - 23 Jun 2006 22:55 GMT
I think I have partially solved my edit problem. It seems that when a row is
added (via binding) to the DataGridView it is added with the ReadOnly
attribute set to True. But this brings up a couple of other questions. Is it
possible to set the default ReadOnly value for a Row to be False? If this is
not possible, if a row has been added to a bound table and the binding causes
a row to be added to the DataGridView then how do I tell which row was just
added?

Thank you.

> I have a few DataGridView questions that hopefully someone will be able to
> help me with some or all of them.
[quoted text clipped - 18 lines]
>
> Kevin
Kevin Burton - 23 Jun 2006 23:16 GMT
After every row is added I execute the following code:

               dgvOrderItemsDiscount.Columns("DiscountQuantity").ReadOnly =
False
               dgvOrderItemsDiscount.Columns("DiscountPercentage").ReadOnly
= False
               dgvOrderItemsDiscount.Columns("DiscountUnitPrice").ReadOnly
= False
               dgvOrderItemsDiscount.Rows(dgvOrderItemsDiscount.Rows.Count
- 1).ReadOnly = False

I still am not able to edit any column in the newly added row.
(dgvOrderItemsDiscount is the DataGridView in question)

Any suggestions?

Thank you.

Kevin

> I have a few DataGridView questions that hopefully someone will be able to
> help me with some or all of them.
[quoted text clipped - 18 lines]
>
> Kevin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.