DataGrid Refresh Problem .NET Framework 1.1 SP1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When we updated the Framework to SP1 a strange thing happened to our
datagrids. If a cell was selected and the underlying datasource changed. The
selected cell would not refresh to the correct value. If there was no row on
that part of the datagrid, you would still see the old value. It would look
like a ghost cell in the middle of the grid!! I positive it's because of SP1,
only machines in our plant with SP1 are affected. Bellow I have code that
will reproduce the problem.

Run the application.
Click on any cell (except the first row) to highlight the text.
Click the filter button.
The cell that you highlighted should still be there.

I did find that it has something to do with the GridColumnStyle. If it's set
to readonly then the problem occurs. If it's not set to read only then
everything is all right.
--
Thanks in advance.
KeithH

*******************************
Public Class Form1
Inherits System.Windows.Forms.Form


#Region " Windows Form Designer generated code "


Public Sub New()
MyBase.New()


'This call is required by the Windows Form Designer.
InitializeComponent()


'Add any initialization after the InitializeComponent() call


End Sub


'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub


'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer


'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents DataGridTableStyle1 As
System.Windows.Forms.DataGridTableStyle
Friend WithEvents DataGridTextBoxColumn1 As
System.Windows.Forms.DataGridTextBoxColumn
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.DataGridTableStyle1 = New System.Windows.Forms.DataGridTableStyle
Me.DataGridTextBoxColumn1 = New
System.Windows.Forms.DataGridTextBoxColumn
Me.Button1 = New System.Windows.Forms.Button
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(16, 16)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.ReadOnly = True
Me.DataGrid1.Size = New System.Drawing.Size(264, 240)
Me.DataGrid1.TabIndex = 0
Me.DataGrid1.TableStyles.AddRange(New
System.Windows.Forms.DataGridTableStyle() {Me.DataGridTableStyle1})
'
'DataGridTableStyle1
'
Me.DataGridTableStyle1.AlternatingBackColor =
System.Drawing.Color.LightYellow()
Me.DataGridTableStyle1.BackColor = System.Drawing.Color.White
Me.DataGridTableStyle1.DataGrid = Me.DataGrid1
Me.DataGridTableStyle1.ForeColor = System.Drawing.Color.Black
Me.DataGridTableStyle1.GridColumnStyles.AddRange(New
System.Windows.Forms.DataGridColumnStyle() {Me.DataGridTextBoxColumn1})
Me.DataGridTableStyle1.GridLineColor =
System.Drawing.Color.LightSteelBlue()
Me.DataGridTableStyle1.HeaderBackColor =
System.Drawing.Color.RoyalBlue()
Me.DataGridTableStyle1.HeaderForeColor = System.Drawing.Color.White
Me.DataGridTableStyle1.LinkColor = System.Drawing.Color.Magenta
Me.DataGridTableStyle1.MappingName = "Table1"
Me.DataGridTableStyle1.ReadOnly = True
Me.DataGridTableStyle1.SelectionBackColor =
System.Drawing.Color.DodgerBlue()
Me.DataGridTableStyle1.SelectionForeColor = System.Drawing.Color.White
'
'DataGridTextBoxColumn1
'
Me.DataGridTextBoxColumn1.Format = ""
Me.DataGridTextBoxColumn1.FormatInfo = Nothing
Me.DataGridTextBoxColumn1.HeaderText = "Column1"
Me.DataGridTextBoxColumn1.MappingName = "Column1"
Me.DataGridTextBoxColumn1.ReadOnly = True
Me.DataGridTextBoxColumn1.Width = 75
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(16, 264)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(64, 24)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Filter"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 310)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)


End Sub


#End Region
Private ds As New DataSet
Private IsFiltered As Boolean = False
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
FillDataSources()
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If IsFiltered Then
ds.Tables("Table1").DefaultView.RowFilter = ""
IsFiltered = False
Else
ds.Tables("Table1").DefaultView.RowFilter = "Column1='Text 1'"
IsFiltered = True
End If
End Sub


Private Sub FillDataSources()
Dim dt As DataTable
Dim dr As DataRow
Dim index As Integer
dt = ds.Tables.Add("Table1")
dt.Columns.Add("Column1")
For index = 1 To 5
dr = dt.NewRow()
dr("Column1") = "Text " & CStr(index)
dt.Rows.Add(dr)
Next
DataGrid1.SetDataBinding(ds.Tables("Table1").DefaultView, "")
End Sub
End Class


***********************
 
Hi,

Thank you for your information. Now I can reproduce the problem on my side
and I have reported the problem to our product team.
I will update you with new information ASAP when I have any new information.

Thanks for you understanding.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi,

I have reported the problem to our product team, confirmed that this is a
problem in our product and we are planning to fix the problem in Whidbey.
So far if you may try to contact MS PSS for request a hotfix for the issue.
You may reach the MS PSS via the link below.
http://support.microsoft.com

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hey guys,

I just wonder do you read questions in this news group often enough. I have
written about this bug in sp1 about two weeks ago (september 24) right after
sp1 was released and no one seemed to read it until Keith brought it up again.

What kind of support Microsoft has this days? I am really dissapointed
because it took me some time to realize that my application was broken
because of sp1 installation and fixing it by removing framework completely
and reinstalling it. What a waste of time.

akula
 
Hi Peter,

Is this registration the same as .Net Password registration because that is
how I was able to create my initial question and reply on your email.

Best regards,
Akula
 
My company has a MSDN subscription
http://www.msdn.microsoft.com/subscriptions/buy/choose/default.aspx
which intitles me to 48 hrs response time to newsgroups by the MSDN
microsoft staff.

What Peter was explaining is if you have a MSDN subscription, you can get
this support as well. How they tell if you have a subscription is by the
email address that you use to post messages to the newsgroup. The link he
gave you , if you have a MSDN subscription, is to set up that email address.

Hope this helps.

BTW update to the problem. I have a support call into Microsoft. Started it
yesterday, and gave him the above example. Haven't heard from him yet, but I
try and keep you posted.
 
Update:
Received this from Microsoft.

This definitely looks like a bug. Here is a workaround that I found; in the
button click handler, you have to set the focus to the data grid before
changing the filter on the dataset table. You can then set the focus back to
the button. See the "added by Me" lines below.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If IsFiltered Then
ds.Tables("Table1").DefaultView.RowFilter = ""
IsFiltered = False
Else
Me.DataGrid1.Focus() ' added by Me
ds.Tables("Table1").DefaultView.RowFilter = "Column1='Text 1'"
IsFiltered = True
Me.Button1.Focus() ' added by Me
End If
End Sub

I've replied to his email asking if there is an easier way to apply this
change (going thru every application, changing, recompiling, and re deploying
isn't my cup of tea)
 
Hi KeithH,

Thanks for the update. I will try your code later.

Question to you. Are you fimiliar with Advapi32.dll? I have a problem with
it. I have used a code from knowledge base article kb295004 to set
permissions on the folder and everything worked fine til yesterday when I got
back to my old project. All of the sudden I have realized that api function
calls do not work properly anymore. For example, I added user to folder
security and granted him certain rights. Later I denied those rights and on
the third call I granted him rights again. However, this 3rd call is failing,
meaning that code is executed fine without errors but grant access is not set
back. So, I looked closely to folder's security tab => advanced option and
saw two ACEs for the same user. One is allowing access to folder, the other
is denying it. And Deny option always take precedence. So I am not sure now
how this happens because 3-4 months ago this code work nicely. Maybe it has
something to do with Microsoft security patches.

Cheers
akula.
 
Sorry, I haven't worked with that dll.
What I like to do, if you have access to Virtual PC (or VMWare) then you can
start from a fresh install and see if it works... going on your theory of
security patches.

Saying this from someone who has never worked with this dll. But can't you
just remove the user instead of denying him? I'm speaking of what I do when I
manually change security permissions. Might be stating the obvious, but it
looks like your second command (deny folder rights) is adding a new entry
instead of modifing the current one. Then the third command (allow rights)
does nothing because it's already has rights......

Good Luck.
Keith
 
The problem with removing user by code from this dll did not work from the
beginning. So I just decided that deny access would be enough for my
application.
My application suppose to simulate windows native properties dialog with
fixed permission set. So, the user will be able either grant read access or
deny it.

I do have Virtual PC but I was kind of lazy to test it. Now I guess I do not
have any other choice to proof my point to my boss.

Maybe Peter Huang will be able to answer that question.

Thanks anyway.:)))

akula
 
Hi

I agree with KeithH¡¯s suggestion, it is better to test your application on
a fresh and clean machine.
Also it is better to post a new issue for a new question, I think you may
try to post in the newsgroup below.
microsoft.public.platformsdk.security


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Is there a hotfix available yet to fix this problem? If so, what is the
reference number for the hotfix?

This is a very serious problem. I am surprised that there is no
knowledge base article yet for a hotfix.

Thanks,

Scott Hutchinson
 
Hi Scott,
There is a KB article for this problem:
890211 FIX: The cells are not cleared when you set the Datasource property
to NULL on cells that have a custom DataGridColumnStyle property in the
..NET Framework 1.1
http://support.microsoft.com/?id=890211

If you need the hotfix, please create a case with Microsoft Developer
Support, so they can send to you the location and password of the hotfix.
When creating the case, just say that you need the hotfix for article
890211.

-Tina

Tina Cruickshank
Microsoft Developer Support, WebData
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Back
Top