472,364 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

How to force upper case in a DataGridView column?

bob
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.

Jun 15 '06 #1
5 20801
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)

<bo*@datasync.com> schreef in bericht
news:11*********************@r2g2000cwb.googlegrou ps.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.

Jun 15 '06 #2
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.C olumnIndex).Value.ToString,
VbStrConv.Uppercase)
dgrModSubDetail.Rows(e.RowIndex).Cells(e.ColumnInd ex).Value = s
End Sub

The text goes to uppercase when you leave the cell.

"bo*@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.

Jun 15 '06 #3
bob
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)

<bo*@datasync.com> schreef in bericht
news:11*********************@r2g2000cwb.googlegrou ps.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.


Jun 15 '06 #4
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

--
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)

<bo*@datasync.com> schreef in bericht
news:11**********************@y41g2000cwy.googlegr oups.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)

<bo*@datasync.com> schreef in bericht
news:11*********************@r2g2000cwb.googlegrou ps.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.

Jun 15 '06 #5
bob
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:
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.C olumnIndex).Value.ToString,
VbStrConv.Uppercase)
dgrModSubDetail.Rows(e.RowIndex).Cells(e.ColumnInd ex).Value = s
End Sub

The text goes to uppercase when you leave the cell.

"bo*@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.


Jun 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Richard MSL | last post by:
How do you make a ComboBox force casing to uppercase? With a TextBox, I do this: TextBox txtName; this.txtName.CharacterCasing = CharacterCasing.Upper; And it makes whatever the user types...
5
by: Nelson | last post by:
In my web form, I am converting all lower case letters to upper case when the user types the characters in the edit boxes. I am achieving that by injecting client side script (onkeyup event) for...
3
by: bob | last post by:
In vb6 you could say s = Format(s, "!") 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...
1
by: martin1 | last post by:
Hi, All, DataGridView is populated with all coumns from database since i need some columns data for condition statement, after that I want to show rest of column in the DataGridView, so how to...
0
by: Mike | last post by:
Hey everyone... I've got three problems with a custom DataGridView column I've built following the "How To: Host Controls in Windows Forms DataGridView Cells" article. The base editing control...
1
by: Chalkie | last post by:
Hello, I've hit what appears to be a serious problem with an unbound datagridview control that Ive added to a VB.Net program. Inadvertently I named one column 'Name' and a second 'Size'. The...
5
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I force the users to enter characters in uppercase? I want to do this in a TextBox control of an aspx page. Then I want the same to be moved to inside a GridView control. Thanks.
0
by: lenniekuah | last post by:
Hi Fellow Good Guys, I need your help, Please Help me. Surprising I encounterd another problem which never happened in VB.NET but in C# technique it causing problem. Here is the explanation...
1
by: Ryno Bower | last post by:
Hey everybody!* I have forms in my database.* Some fields I want to force so that whatever text i fill in must be uppercase, even though caps lock is off. * I have tried after update events,...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.