|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to force upper case in a DataGridView column?world, I'm finding. In vb6 you could use "!" to force text to upper case in the format function. I've searched the vb.net help system and can't find any help on formatting text. There's plenty of help formatting numbers, dates, and times, though. I'm in the phase of converting from 6 to Net and it seems that even the simplest thing is very, very complicated. And it doesn't help that the Net help stuff never gives you a simple example of anything. Even a simple thing like this is either wrapped in a series of complicated lines of "help" code for something else, or just doesn't exist at all. I think in this case, there may be no help at all. To format a DataGridView column, I think you're supposed to first set a cell style, then apply that cell style to the column's CellTemplate property. The cell style has a format property, which I think takes the same type of formatting strings as the Format function. But, as I said, I can't find out what formatting string(s) to use to force upper or lower case in either the cell.style.format property or the format function. Please, if you know the answer to this simple question, let me know. Thanks. You could also set the column to upper in your sql query :-) then you only
need to type UPPER(mycolumn) Hope this helps Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook) <b**@datasync.com> schreef in bericht news:1150353761.824094.76710@r2g2000cwb.googlegroups.com... > Now this ought to be a simple matter. But nothing's simple in the Net > world, I'm finding. > > In vb6 you could use "!" to force text to upper case in the format > function. I've searched the vb.net help system and can't find any help > on formatting text. There's plenty of help formatting numbers, dates, > and times, though. > > I'm in the phase of converting from 6 to Net and it seems that even the > simplest thing is very, very complicated. And it doesn't help that the > Net help stuff never gives you a simple example of anything. Even a > simple thing like this is either wrapped in a series of complicated > lines of "help" code for something else, or just doesn't exist at all. > I think in this case, there may be no help at all. > > To format a DataGridView column, I think you're supposed to first set a > cell style, then apply that cell style to the column's CellTemplate > property. The cell style has a format property, which I think takes the > same type of formatting strings as the Format function. But, as I said, > I can't find out what formatting string(s) to use to force upper or > lower case in either the cell.style.format property or the format > function. > > Please, if you know the answer to this simple question, let me know. > Thanks. > Peter,
Great idea! Will that also affect new entries I make in a sell after filling the grid? Also, there MUST be a "format specifier" to format text to upper case -- do you know what it is? (I might need to use the Format method somewhere else one day) Thanks. Peter Proost wrote: Show quoteHide quote > You could also set the column to upper in your sql query :-) then you only > need to type UPPER(mycolumn) > > Hope this helps > > Peter > > -- > Programming today is a race between software engineers striving to build > bigger and better idiot-proof programs, and the Universe trying to produce > bigger and better idiots. So far, the Universe is winning. (Rich Cook) > > <b**@datasync.com> schreef in bericht > news:1150353761.824094.76710@r2g2000cwb.googlegroups.com... > > Now this ought to be a simple matter. But nothing's simple in the Net > > world, I'm finding. > > > > In vb6 you could use "!" to force text to upper case in the format > > function. I've searched the vb.net help system and can't find any help > > on formatting text. There's plenty of help formatting numbers, dates, > > and times, though. > > > > I'm in the phase of converting from 6 to Net and it seems that even the > > simplest thing is very, very complicated. And it doesn't help that the > > Net help stuff never gives you a simple example of anything. Even a > > simple thing like this is either wrapped in a series of complicated > > lines of "help" code for something else, or just doesn't exist at all. > > I think in this case, there may be no help at all. > > > > To format a DataGridView column, I think you're supposed to first set a > > cell style, then apply that cell style to the column's CellTemplate > > property. The cell style has a format property, which I think takes the > > same type of formatting strings as the Format function. But, as I said, > > I can't find out what formatting string(s) to use to force upper or > > lower case in either the cell.style.format property or the format > > function. > > > > Please, if you know the answer to this simple question, let me know. > > Thanks. > > Hi, I don't know anything about the datagridview because I'm still working
with vs 2003 But I think you need to do the toUpper yourself for new entries, but I'm not 100% sure Greetz Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook) <b**@datasync.com> schreef in bericht news:1150382469.051778.221240@y41g2000cwy.googlegroups.com... > Peter, > > Great idea! Will that also affect new entries I make in a sell after > filling the grid? Also, there MUST be a "format specifier" to format > text to upper case -- do you know what it is? (I might need to use the > Format method somewhere else one day) > > Thanks. > > Peter Proost wrote: > > You could also set the column to upper in your sql query :-) then you only > > need to type UPPER(mycolumn) > > > > Hope this helps > > > > Peter > > > > -- > > Programming today is a race between software engineers striving to build > > bigger and better idiot-proof programs, and the Universe trying to produce > > bigger and better idiots. So far, the Universe is winning. (Rich Cook) > > > > <b**@datasync.com> schreef in bericht > > news:1150353761.824094.76710@r2g2000cwb.googlegroups.com... > > > Now this ought to be a simple matter. But nothing's simple in the Net > > > world, I'm finding. > > > > > > In vb6 you could use "!" to force text to upper case in the format > > > function. I've searched the vb.net help system and can't find any help > > > on formatting text. There's plenty of help formatting numbers, dates, > > > and times, though. > > > > > > I'm in the phase of converting from 6 to Net and it seems that even the > > > simplest thing is very, very complicated. And it doesn't help that the > > > Net help stuff never gives you a simple example of anything. Even a > > > simple thing like this is either wrapped in a series of complicated > > > lines of "help" code for something else, or just doesn't exist at all. > > > I think in this case, there may be no help at all. > > > > > > To format a DataGridView column, I think you're supposed to first set a > > > cell style, then apply that cell style to the column's CellTemplate > > > property. The cell style has a format property, which I think takes the > > > same type of formatting strings as the Format function. But, as I said, > > > I can't find out what formatting string(s) to use to force upper or > > > lower case in either the cell.style.format property or the format > > > function. > > > > > > Please, if you know the answer to this simple question, let me know. > > > Thanks. > > > > Here is something I am currently doing when editing a cell in a datagridview.
In the CellValueChanged Event I do this: Private Sub DatagridView1_CellValueChanged(...)Handles... Dim s As String = StrConv(dgrModSubDetail.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString, VbStrConv.Uppercase) dgrModSubDetail.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = s End Sub The text goes to uppercase when you leave the cell. Show quoteHide quote "b**@datasync.com" wrote: > Now this ought to be a simple matter. But nothing's simple in the Net > world, I'm finding. > > In vb6 you could use "!" to force text to upper case in the format > function. I've searched the vb.net help system and can't find any help > on formatting text. There's plenty of help formatting numbers, dates, > and times, though. > > I'm in the phase of converting from 6 to Net and it seems that even the > simplest thing is very, very complicated. And it doesn't help that the > Net help stuff never gives you a simple example of anything. Even a > simple thing like this is either wrapped in a series of complicated > lines of "help" code for something else, or just doesn't exist at all. > I think in this case, there may be no help at all. > > To format a DataGridView column, I think you're supposed to first set a > cell style, then apply that cell style to the column's CellTemplate > property. The cell style has a format property, which I think takes the > same type of formatting strings as the Format function. But, as I said, > I can't find out what formatting string(s) to use to force upper or > lower case in either the cell.style.format property or the format > function. > > Please, if you know the answer to this simple question, let me know. > Thanks. > > Rich,
I haven't tried your code yet (that's next, if the following doesn't work), but can you tell me what THIS doesn't work: =========================================================== Private Sub grd_CellLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grd.CellLeave Dim col As New DataGridViewColumn, cell As New DataGridViewTextBoxCell col = grd.Columns(e.ColumnIndex) If col.Name = "Case" Then cell = grd.CurrentCell If Not IsDBNull(cell.Value) Then cell.Value = UCase(cell.Value) End If End If End Sub =========================================================== After this runs, the value of the cell in the "Case" column remains lower case! Thanks. Rich wrote: Show quoteHide quote > Here is something I am currently doing when editing a cell in a datagridview. > In the CellValueChanged Event I do this: > > Private Sub DatagridView1_CellValueChanged(...)Handles... > Dim s As String = > StrConv(dgrModSubDetail.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString, > VbStrConv.Uppercase) > dgrModSubDetail.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = s > End Sub > > The text goes to uppercase when you leave the cell. > > "b**@datasync.com" wrote: > > Now this ought to be a simple matter. But nothing's simple in the Net > > world, I'm finding. > > > > In vb6 you could use "!" to force text to upper case in the format > > function. I've searched the vb.net help system and can't find any help > > on formatting text. There's plenty of help formatting numbers, dates, > > and times, though. > > > > I'm in the phase of converting from 6 to Net and it seems that even the > > simplest thing is very, very complicated. And it doesn't help that the > > Net help stuff never gives you a simple example of anything. Even a > > simple thing like this is either wrapped in a series of complicated > > lines of "help" code for something else, or just doesn't exist at all. > > I think in this case, there may be no help at all. > > > > To format a DataGridView column, I think you're supposed to first set a > > cell style, then apply that cell style to the column's CellTemplate > > property. The cell style has a format property, which I think takes the > > same type of formatting strings as the Format function. But, as I said, > > I can't find out what formatting string(s) to use to force upper or > > lower case in either the cell.style.format property or the format > > function. > > > > Please, if you know the answer to this simple question, let me know. > > Thanks. > > > >
changing the date format in vb.net
Datasets - use 1 or many? Assigning the result of a '/' division to an integer type causes rounding last ditch attempt to try and get this working Calling a batch file from vb.net with parameters Dealing with NULL values in Integer fields Mulples threads and impersonation What's the Best Startup Scenario for Unattended Server Execution? Handle pointers from delphi client to a vb.net dll From Delphi to VB |
|||||||||||||||||||||||