|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
change gridview textHi, All,
Anyone knows how to change gridview text info? specifically the gridview populate from sql db, first column is string rather than number, i want to change first row in first column into another string, for example "Book" , but I don't want this chnage to affect database. Thanks On Tue, 22 Aug 2006 11:04:02 -0700, martin1 <mart***@discussions.microsoft.com> wrote:
>Hi, All, I'm not sure, but I think you are after something like this using the CellFormatting Event:> >Anyone knows how to change gridview text info? specifically the gridview >populate from sql db, first column is string rather than number, i want to >change first row in first column into another string, for example "Book" , >but I don't want this chnage to affect database. > >Thanks Private Sub MainGridView_CellFormatting(ByVal sender As Object, ByVal e As _ System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles MainGridView.CellFormatting With Me.MainGridView.Columns(e.ColumnIndex) Select Case .Name Case "Scans" e.Value = IIf(CType(e.Value, Boolean), "Yes", "No").ToString Case "Genre" e.Value = String.Concat(GetGenreName(CType(e.Value, Integer)), ": ", _ Me.MainGrid.Rows(e.RowIndex).Cells("Style").Value) End Select End With End Sub In the above, in the column named "Scans", the db's Boolean values are displayed as a string value rather than True or False. In the column named "Genre", a concacted string is displayed which consists of a string value based on the db's genre integer value, plus the string value from a hidden column named "Style". You can also use "e.RowIndex" to target specfic cells. Gene
Conversion
DLL created in .NET cannot use? (Inno Setup) Drawing images in different shapes VB.Net Merging Datasets Incorrect behavior of IIf in VB.NET (.NET Framework 1.1 SP1) problem in converting to C# Catch reference error how? Remove x number of charaters from string. Vb.net Getting error LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in atlmincr database connection |
|||||||||||||||||||||||