Discussion:
DefaultCellStyle.FormatProvider not work!!
(too old to reply)
m***@yahoo.com
2007-07-05 22:10:06 UTC
Permalink
I west a lot of time to put below code work. but we west time for poor
Microsof Framework!
see also: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=21016&SiteID=1

Any MPV to resolve this problem in decade?
I suggest Microsoft to Publish a Book that contain all code that not
work. this save our time.
============================
Public Class Form1
Class MyFormat
Implements IFormatProvider
Implements ICustomFormatter




Public Function GetFormat(ByVal formatType As System.Type) As
Object Implements System.IFormatProvider.GetFormat
Return Me
End Function

Public Function Format(ByVal format_str As String, ByVal arg
As Object, ByVal formatProvider As System.IFormatProvider) As String
Implements System.ICustomFormatter.Format
Return New String("blabal")
End Function

End Class


WithEvents DataGridView1 As New System.Windows.Forms.DataGridView
WithEvents Column1 As New
System.Windows.Forms.DataGridViewTextBoxColumn

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'=====this follow lines working
Dim s = String.Format(New MyFormat, "{0}", 11212)
MsgBox(s)


'=========But this not work ??
Me.Column1.DefaultCellStyle.FormatProvider = New MyFormat
Me.Column1.DefaultCellStyle.Format = "{0}"

DataGridView1.Columns.Add(Me.Column1)
DataGridView1.Size = New System.Drawing.Size(389, 176)
Me.Controls.Add(DataGridView1)

End Sub
End Class
suriya k
2010-09-22 10:14:50 UTC
Permalink
I have also same problem
Please help anybody?
Post by m***@yahoo.com
I west a lot of time to put below code work. but we west time for poor
Microsof Framework!
see also: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=21016&SiteID=1
Any MPV to resolve this problem in decade?
I suggest Microsoft to Publish a Book that contain all code that not
work. this save our time.
============================
Public Class Form1
Class MyFormat
Implements IFormatProvider
Implements ICustomFormatter
Public Function GetFormat(ByVal formatType As System.Type) As
Object Implements System.IFormatProvider.GetFormat
Return Me
End Function
Public Function Format(ByVal format_str As String, ByVal arg
As Object, ByVal formatProvider As System.IFormatProvider) As String
Implements System.ICustomFormatter.Format
Return New String("blabal")
End Function
End Class
WithEvents DataGridView1 As New System.Windows.Forms.DataGridView
WithEvents Column1 As New
System.Windows.Forms.DataGridViewTextBoxColumn
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'=====this follow lines working
Dim s = String.Format(New MyFormat, "{0}", 11212)
MsgBox(s)
'=========But this not work ??
Me.Column1.DefaultCellStyle.FormatProvider = New MyFormat
Me.Column1.DefaultCellStyle.Format = "{0}"
DataGridView1.Columns.Add(Me.Column1)
DataGridView1.Size = New System.Drawing.Size(389, 176)
Me.Controls.Add(DataGridView1)
End Sub
End Class
Submitted via EggHeadCafe - Software Developer Portal of Choice
Auto-Generate Code for LINQ to SQL Repository Pattern using T4
http://www.eggheadcafe.com/tutorials/aspnet/a7ee34d2-c297-4ec8-a933-69254242b21b/autogenerate-code-for-linq-to-sql-repository-pattern-using-t4.aspx
Loading...