From: Prashwee on 6 Nov 2006 03:19 Hello All In my windows application I am using DataGridView as my grid control. I populated let's say 10 rows of data and modified 3 random rows. I need to put some sort of Edit Marker in the row header. This can be an image. Please any one share a code for this implementation. If i were to save this records, how can I trap those 3 modified rows without going throgh the whole row set? Thanks in Advance Prash
From: Brendon Bezuidenhout on 6 Nov 2006 14:43 Prashwee, I achieve something similiar when a check box value has changed, add a DataGridViewImageCell 1st and an ImageList with your Status images in it, and then trap the CellFormatting event like below <code> Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting If e.ColumnIndex = 0 Then setDGVImageStatus(sender, e) If e.ColumnIndex = 3 Then setDGVSignificant(sender, e) End Sub </code> And add the following Sub for actually setting the Image cell's value - Don't forget validation :-) I was trapping when value of my ComboBox ''' <summary> ''' Sets the image column of the datagridview dependant on the value of the ysnResolved column ''' </summary> ''' <param name="sender">The DataGridView who's column needs altering</param> ''' <param name="e">DataGridViewCellFormattingEventArgs</param> ''' <remarks>Sender as object so that this block can be reused for both grids</remarks> Private Sub setDGVImageStatus(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Dim colName As String = DirectCast(sender, DataGridView).Columns(e.ColumnIndex).Name.ToString 'getResolvedDGVColName(sender) just returns the column name of my DataGridViewCheckBoxCell If DirectCast(sender, DataGridView).Rows(e.RowIndex).Cells(getResolvedDGVColName(sender)).Value.Equals(False) Then e.Value = iml.Images(1) Else e.Value = iml.Images(0) End If End Sub Hope that Helps you out - if not let me know Brendon "Prashwee" <prashantha.weerakoon(a)ifs.lk> wrote in message news:%23ZPslxXAHHA.3316(a)TK2MSFTNGP02.phx.gbl... > Hello All > > In my windows application I am using DataGridView as my grid control. I > populated let's say 10 rows of data and modified 3 random rows. I need to > put some sort of Edit Marker in the row header. This can be an image. > Please any one share a code for this implementation. > > If i were to save this records, how can I trap those 3 modified rows > without going throgh the whole row set? > > Thanks in Advance > Prash >
From: Prashwee on 6 Nov 2006 23:16 Hello Brendon Where do you insert your image in the grid? Is it in the row header colunm or just another grid cell? /Prash "Brendon Bezuidenhout" <absent(a)bezfamily.net> wrote in message news:OgWNavdAHHA.3620(a)TK2MSFTNGP02.phx.gbl... > Prashwee, > > I achieve something similiar when a check box value has changed, add a > DataGridViewImageCell 1st and an ImageList with your Status images in it, > and then trap the CellFormatting event like below > > <code> > Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e > As DataGridViewCellFormattingEventArgs) Handles > DataGridView1.CellFormatting > If e.ColumnIndex = 0 Then setDGVImageStatus(sender, e) > If e.ColumnIndex = 3 Then setDGVSignificant(sender, e) > End Sub > </code> > > And add the following Sub for actually setting the Image cell's value - > Don't forget validation :-) > I was trapping when value of my ComboBox > > ''' <summary> > ''' Sets the image column of the datagridview dependant on the > value of the ysnResolved column > ''' </summary> > ''' <param name="sender">The DataGridView who's column needs > altering</param> > ''' <param name="e">DataGridViewCellFormattingEventArgs</param> > ''' <remarks>Sender as object so that this block can be reused for > both grids</remarks> > Private Sub setDGVImageStatus(ByVal sender As Object, ByVal e As > DataGridViewCellFormattingEventArgs) > Dim colName As String = DirectCast(sender, > DataGridView).Columns(e.ColumnIndex).Name.ToString > 'getResolvedDGVColName(sender) just returns the column name of my > DataGridViewCheckBoxCell > > If DirectCast(sender, > DataGridView).Rows(e.RowIndex).Cells(getResolvedDGVColName(sender)).Value.Equals(False) > Then > e.Value = iml.Images(1) > Else > e.Value = iml.Images(0) > End If > > End Sub > > Hope that Helps you out - if not let me know > Brendon > > "Prashwee" <prashantha.weerakoon(a)ifs.lk> wrote in message > news:%23ZPslxXAHHA.3316(a)TK2MSFTNGP02.phx.gbl... >> Hello All >> >> In my windows application I am using DataGridView as my grid control. I >> populated let's say 10 rows of data and modified 3 random rows. I need to >> put some sort of Edit Marker in the row header. This can be an image. >> Please any one share a code for this implementation. >> >> If i were to save this records, how can I trap those 3 modified rows >> without going throgh the whole row set? >> >> Thanks in Advance >> Prash >> >
From: Brendon Bezuidenhout on 7 Nov 2006 13:47 Pashwee, Add a DataGridViewImageColumn to the DataGridView and an ImageList to the form - Failing that search for DataGridViewImageColum and DataGridViewImageCell on Google HTH Brendon "Prashwee" <prashantha.weerakoon(a)ifs.lk> wrote in message news:euxB9NiAHHA.4672(a)TK2MSFTNGP02.phx.gbl... > Hello Brendon > > Where do you insert your image in the grid? > Is it in the row header colunm or just another grid cell? > /Prash > > "Brendon Bezuidenhout" <absent(a)bezfamily.net> wrote in message > news:OgWNavdAHHA.3620(a)TK2MSFTNGP02.phx.gbl... >> Prashwee, >> >> I achieve something similiar when a check box value has changed, add a >> DataGridViewImageCell 1st and an ImageList with your Status images in it, >> and then trap the CellFormatting event like below >> >> <code> >> Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e >> As DataGridViewCellFormattingEventArgs) Handles >> DataGridView1.CellFormatting >> If e.ColumnIndex = 0 Then setDGVImageStatus(sender, e) >> If e.ColumnIndex = 3 Then setDGVSignificant(sender, e) >> End Sub >> </code> >> >> And add the following Sub for actually setting the Image cell's value - >> Don't forget validation :-) >> I was trapping when value of my ComboBox >> >> ''' <summary> >> ''' Sets the image column of the datagridview dependant on the >> value of the ysnResolved column >> ''' </summary> >> ''' <param name="sender">The DataGridView who's column needs >> altering</param> >> ''' <param name="e">DataGridViewCellFormattingEventArgs</param> >> ''' <remarks>Sender as object so that this block can be reused for >> both grids</remarks> >> Private Sub setDGVImageStatus(ByVal sender As Object, ByVal e As >> DataGridViewCellFormattingEventArgs) >> Dim colName As String = DirectCast(sender, >> DataGridView).Columns(e.ColumnIndex).Name.ToString >> 'getResolvedDGVColName(sender) just returns the column name of my >> DataGridViewCheckBoxCell >> >> If DirectCast(sender, >> DataGridView).Rows(e.RowIndex).Cells(getResolvedDGVColName(sender)).Value.Equals(False) >> Then >> e.Value = iml.Images(1) >> Else >> e.Value = iml.Images(0) >> End If >> >> End Sub >> >> Hope that Helps you out - if not let me know >> Brendon >> >> "Prashwee" <prashantha.weerakoon(a)ifs.lk> wrote in message >> news:%23ZPslxXAHHA.3316(a)TK2MSFTNGP02.phx.gbl... >>> Hello All >>> >>> In my windows application I am using DataGridView as my grid control. I >>> populated let's say 10 rows of data and modified 3 random rows. I need >>> to put some sort of Edit Marker in the row header. This can be an image. >>> Please any one share a code for this implementation. >>> >>> If i were to save this records, how can I trap those 3 modified rows >>> without going throgh the whole row set? >>> >>> Thanks in Advance >>> Prash >>> >> > >
|
Pages: 1 Prev: Outlook PST Files Next: Problem Adding and Using Resource Files |