?
Solved

Editing DataGridTextBoxColumn

Posted on 2006-06-05
3
Medium Priority
?
338 Views
Last Modified: 2012-08-13
I am trying to edit a DataGridTextBoxColumn derivated classe and i'm having problem with currency manager. The class has the function SetColumnValueAtRow, which takes 3 paramaters (CurrencyManager, index, value).

Currency Manager is usualy passed as argument since every sub are derivated from the DataGridTextBoxColumn, so any idea how i could set a value un this textbox column ?
0
Comment
Question by:TheSonics
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16841488
This is the way that the base DataGridTextBoxColumn.SetColumnValueAtRow does it:


Protected Friend Overridable Sub SetColumnValueAtRow(ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal value As Object)
      Me.CheckValidDataSource(source)
      If (source.Position <> rowNum) Then
            Throw New ArgumentException(SR.GetString("DataGridColumnListManagerPosition"), "rowNum")
      End If
      If TypeOf source.Item(rowNum) Is IEditableObject Then
            DirectCast(source.Item(rowNum), IEditableObject).BeginEdit
      End If
      Me.PropertyDescriptor.SetValue(source.Item(rowNum), value)
End Sub


Bob
0
 

Author Comment

by:TheSonics
ID: 16842872
source is not accessible since it is private. same for the PropertyDescriptor
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 16843220
I am sorry, I didn't try it first.  Here is a modified, untest example without compiler errors:

  Protected Overrides Sub SetColumnValueAtRow(ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal value As Object)
    Me.CheckValidDataSource(source)
    If (source.Position <> rowNum) Then
      Throw New ArgumentException("Row doesn't match current position")
    End If
    If TypeOf source.List(rowNum) Is IEditableObject Then
      DirectCast(source.List(rowNum), IEditableObject).BeginEdit()
    End If
    CType(Me, DataGridColumnStyle).PropertyDescriptor.SetValue(source.List(rowNum), value)
  End Sub

Bob
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question