|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGrid custom classmy DataGrid editable, how would I do that? When I use this class none of the columns are editable even when I set the ReadOnly property to false? Thanks Peter '------------------------------------------------- Public Class MyDataGrid Inherits DataGrid Private _processVars As ProcessVariables Private _sortDir As String = "NONE" Private _sortVar As String = "NONE" Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) Dim pt As New Point(e.X, e.Y) Dim hit As DataGrid.HitTestInfo = Me.HitTest(pt) If hit.Type = HitTestType.ColumnHeader AndAlso (hit.Column = 1 Or hit.Column = 2) Then Dim col As String = Me.TableStyles(0).GridColumnStyles(hit.Column).MappingName If Me._sortVar.Equals(col) Then If hit.Column = 1 Then If Me._sortDir.Equals("ASC") Then Me._sortDir = "DESC" ElseIf Me._sortDir = "DESC" Then Me._sortDir = "NONE" Else Me._sortDir = "ASC" End If Else If Me._sortDir.Equals("ASC") Then Me._sortDir = "DESC" Else Me._sortDir = "ASC" End If End If Else Me._sortDir = "DESC" Me._sortVar = col End If Me._processVars.SortGrid(Me, Me._sortDir, Me._sortVar) Return 'don't call baseclass End If MyBase.OnMouseDown(e) End Sub 'OnMouseDown Public WriteOnly Property ProcessVars() As ProcessVariables Set(ByVal Value As ProcessVariables) Me._processVars = Value End Set End Property End Class 'MyDataGrid Pieter has give us a good sample to do the trick. You can make all other
columns non-editable to make one column editable. Kevin Yu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Hi Peter,
I'd like to know if this issue has been resolved yet. Is there anything that I can help. I'm still monitoring on it. If you have any questions, please feel free to post them in the community. Kevin Yu Microsoft Online Community Support ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Pieter,
Because you probably don't use the webbased newsgroupreader and than does not log on with your MSDN emailadres (account) Otherwise there will be at least action taken on your question (checked if there is already given a good answer (as Kevin did with yours and replied in this case to check if the answer was as wanted), given an answer or bring the answer back to their backoffice and reply accoording to that). Cor Show quoteHide quote "Pieter" <pietercou***@hotmail.com> schreef in bericht news:up%2396CiuGHA.2448@TK2MSFTNGP06.phx.gbl... > Why do I never get such a help from Microsoft? :-) > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message Ah, it HAS to be the web-based email-account? I'm using Outlook Express. I news:%23iRlHnjuGHA.2448@TK2MSFTNGP06.phx.gbl... > Because you probably don't use the webbased newsgroupreader and than does > not log on with your MSDN emailadres (account) tried it some time ago with the special-made MDSN-emaialdres, but I still din't get answers :-) Yes, Pieter. Try to use web-based community and your registered MSDN email
address. And you'll be replied within 24 hours. Kevin Yu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Pieter,
That does not mean that you cannot get an answer from Kevin, Jeffrey or other Microsoft people if you don't do that, but than they do it completely as community member, free to do that or not. Cor Show quoteHide quote "Pieter" <pietercou***@hotmail.com> schreef in bericht news:up%2396CiuGHA.2448@TK2MSFTNGP06.phx.gbl... > Why do I never get such a help from Microsoft? :-) >
Show quote
Hide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message When I create a sample application it works, but in my application that I am news:y$L0lhguGHA.2004@TK2MSFTNGXA01.phx.gbl... > Hi Peter, > > I'd like to know if this issue has been resolved yet. Is there anything > that I can help. I'm still monitoring on it. If you have any questions, > please feel free to post them in the community. > > Kevin Yu > Microsoft Online Community Support > ================================================== > > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > working on it does not work. The cursor goes into the grid cell like you can edit the contents, but when I press a key nothing happens. Peter,
Than in your case I would check the code of your application again. There has never been any magic in code. It works or it does not works, maybe you have used a wrong variable name or not filled it with the right data. It is mostly hard to give any help in that. Cor Show quoteHide quote "Peter" <pczurak@nospam.nospam> schreef in bericht news:%23qkKPojuGHA.2036@TK2MSFTNGP05.phx.gbl... > > "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message > news:y$L0lhguGHA.2004@TK2MSFTNGXA01.phx.gbl... >> Hi Peter, >> >> I'd like to know if this issue has been resolved yet. Is there anything >> that I can help. I'm still monitoring on it. If you have any questions, >> please feel free to post them in the community. >> >> Kevin Yu >> Microsoft Online Community Support >> ================================================== >> >> (This posting is provided "AS IS", with no warranties, and confers no >> rights.) >> > > When I create a sample application it works, but in my application that I > am working on it does not work. The cursor goes into the grid cell like > you can edit the contents, but when I press a key nothing happens. > Hi Peter,
I'd like to know if this issue has been resolved yet. Is there anything that I can help. I'm still monitoring on it. If you have any questions, please feel free to post them in the community. Kevin Yu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.)
Show quote
Hide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message I have not resolved my problem yet.news:ZFXUdgQvGHA.2004@TK2MSFTNGXA01.phx.gbl... > Hi Peter, > > I'd like to know if this issue has been resolved yet. Is there anything > that I can help. I'm still monitoring on it. If you have any questions, > please feel free to post them in the community. > > Kevin Yu > Microsoft Online Community Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications. > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > http://msdn.microsoft.com/subscriptions/support/default.aspx. > ================================================== > > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > The problem is with my custom class the "MyDataGrid" because when I use datagrid directly it works, but when I inherit the DataGrid in MyDataGrid it does not work. It's like my class is cosumming the KeyPress Event but it's never doing anything with them. here's the class again '------------------------------------------------- Public Class MyDataGrid Inherits DataGrid Private _processVars As ProcessVariables Private _sortDir As String = "NONE" Private _sortVar As String = "NONE" Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) Dim pt As New Point(e.X, e.Y) Dim hit As DataGrid.HitTestInfo = Me.HitTest(pt) If hit.Type = HitTestType.ColumnHeader AndAlso (hit.Column = 1 Or hit.Column = 2) Then Dim col As String = Me.TableStyles(0).GridColumnStyles(hit.Column).MappingName If Me._sortVar.Equals(col) Then If hit.Column = 1 Then If Me._sortDir.Equals("ASC") Then Me._sortDir = "DESC" ElseIf Me._sortDir = "DESC" Then Me._sortDir = "NONE" Else Me._sortDir = "ASC" End If Else If Me._sortDir.Equals("ASC") Then Me._sortDir = "DESC" Else Me._sortDir = "ASC" End If End If Else Me._sortDir = "DESC" Me._sortVar = col End If Me._processVars.SortGrid(Me, Me._sortDir, Me._sortVar) Return 'don't call baseclass End If MyBase.OnMouseDown(e) End Sub 'OnMouseDown Public WriteOnly Property ProcessVars() As ProcessVariables Set(ByVal Value As ProcessVariables) Me._processVars = Value End Set End Property End Class 'MyDataGrid Hi Peter,
I checked your code and found that currently, your control is allowing all the columns to be editable, because at the end of OnMouseDown, you're calling MyBase.OnMouseDown(e). So, if you only need the columns that meets the criteria to be editable, you can put MyBase.OnMouseDown(e) inside the if block. Also, I don't quite understand why you use If hit.Type = HitTestType.ColumnHeader AndAlso (hit.Column = 1 Or hit.Column = 2). Are you allowing the second and third column to be editable? Or sortable? Kevin Yu Microsoft Online Community Support ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.)
Show quote
Hide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message I am allowing second and 3rd column to be sortable.news:nV29FU4vGHA.1992@TK2MSFTNGXA01.phx.gbl... > Hi Peter, > > I checked your code and found that currently, your control is allowing all > the columns to be editable, because at the end of OnMouseDown, you're > calling MyBase.OnMouseDown(e). So, if you only need the columns that meets > the criteria to be editable, you can put MyBase.OnMouseDown(e) inside the > if block. > > Also, I don't quite understand why you use If hit.Type = > HitTestType.ColumnHeader AndAlso (hit.Column = 1 Or hit.Column = 2). Are > you allowing the second and third column to be editable? Or sortable? > > Kevin Yu > Microsoft Online Community Support > ================================================== > > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > My problem is that I am not able to edit any of the columns, the cursor goes into a cell like it would allow you to edit, but when I type nothing shows up on the screen. If I don't use my custom class just grid directly everything works, but if I use my class and inherit the DataGrid class it does not work, so I know the problem is with my class, but I don't know how or what to fix. Hi Peter,
The MyDataGrid control works fine on my machine. When I press the key, a certain cell can be edited. Have you ever handle the key events of the Textbox in that cell? Kevin Yu Microsoft Online Community Support ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Hi Peter,
Is there anything that I can help at this point? Kevin Yu Microsoft Online Community Support ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.)
Show quote
Hide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message No I have not, how would I do that?news:66ViXfEwGHA.3028@TK2MSFTNGXA01.phx.gbl... > Hi Peter, > > The MyDataGrid control works fine on my machine. When I press the key, a > certain cell can be edited. Have you ever handle the key events of the > Textbox in that cell? > > Kevin Yu > Microsoft Online Community Support > ================================================== > > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > Currently I have no ideal how to trouble shoot this problem, I have no idea where the key press or key down event go to. Peter,
In my idea to debug this you should break your control down. Start with a new one and add first the members that don't work in your idea and debug them than, that mostly brings you to a solution. If you do that, than you make it as well possible to send that small part to the newsgroups so that Kevin or somebody else including me, can try your problem as well. Cor Show quoteHide quote "Peter" <pczurak@nospam.nospam> schreef in bericht news:efeLq4nwGHA.2260@TK2MSFTNGP03.phx.gbl... > > "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message > news:66ViXfEwGHA.3028@TK2MSFTNGXA01.phx.gbl... >> Hi Peter, >> >> The MyDataGrid control works fine on my machine. When I press the key, a >> certain cell can be edited. Have you ever handle the key events of the >> Textbox in that cell? >> >> Kevin Yu >> Microsoft Online Community Support >> ================================================== >> >> (This posting is provided "AS IS", with no warranties, and confers no >> rights.) >> > > No I have not, how would I do that? > > Currently I have no ideal how to trouble shoot this problem, I have no > idea where the key press or key down event go to. >
Show quote
Hide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message I have found the problem, the problem was the DataGrid itself was set to news:uk3pJUowGHA.4476@TK2MSFTNGP02.phx.gbl... > Peter, > > In my idea to debug this you should break your control down. > > Start with a new one and add first the members that don't work in your > idea and debug them than, that mostly brings you to a solution. If you do > that, than you make it as well possible to send that small part to the > newsgroups so that Kevin or somebody else including me, can try your > problem as well. > > Cor > > "Peter" <pczurak@nospam.nospam> schreef in bericht > news:efeLq4nwGHA.2260@TK2MSFTNGP03.phx.gbl... >> >> "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message >> news:66ViXfEwGHA.3028@TK2MSFTNGXA01.phx.gbl... >>> Hi Peter, >>> >>> The MyDataGrid control works fine on my machine. When I press the key, a >>> certain cell can be edited. Have you ever handle the key events of the >>> Textbox in that cell? >>> >>> Kevin Yu >>> Microsoft Online Community Support >>> ================================================== >>> >>> (This posting is provided "AS IS", with no warranties, and confers no >>> rights.) >>> >> >> No I have not, how would I do that? >> >> Currently I have no ideal how to trouble shoot this problem, I have no >> idea where the key press or key down event go to. >> > > ReadOnly, the columns and ColumnStyles were set to ReadOnly = false, but I guess that does not override the DataGrid readonly property, I though that it did. Thanks everyone for your help. I'm using exactly the code you have provided in your last post.
Kevin Yu Microsoft Online Community Support ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.)
How to create a local server (i.e., localhost)
For Each Loop in ASP.NET 2.0 VB.NET Datagrid Sorting of Numbers VB.NET XML Documentor Configuration File code error difference in Filestream + StreamWriter and just StreamWriter serialization, object within a dataset OFF TOPIC: IL DASM the MSIL disassebler Missing Dll mscoree.dll Insufficient key column information for updating or refreshing. |
|||||||||||||||||||||||