473,699 Members | 3,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.form at property or the format
function.

Please, if you know the answer to this simple question, let me know.
Thanks.

Jun 15 '06 #1
5 21412
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.c om> schreef in bericht
news:11******** *************@r 2g2000cwb.googl egroups.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.form at 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 CellValueChange d Event I do this:

Private Sub DatagridView1_C ellValueChanged (...)Handles...
Dim s As String =
StrConv(dgrModS ubDetail.Rows(e .RowIndex).Cell s(e.ColumnIndex ).Value.ToStrin g,
VbStrConv.Upper case)
dgrModSubDetail .Rows(e.RowInde x).Cells(e.Colu mnIndex).Value = s
End Sub

The text goes to uppercase when you leave the cell.

"bo*@datasync.c om" 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.form at 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.c om> schreef in bericht
news:11******** *************@r 2g2000cwb.googl egroups.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.form at 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.c om> schreef in bericht
news:11******** **************@ y41g2000cwy.goo glegroups.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.c om> schreef in bericht
news:11******** *************@r 2g2000cwb.googl egroups.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.form at 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(B yVal sender As Object, ByVal e As
System.Windows. Forms.DataGridV iewCellEventArg s) Handles grd.CellLeave
Dim col As New DataGridViewCol umn, cell As New
DataGridViewTex tBoxCell
col = grd.Columns(e.C olumnIndex)
If col.Name = "Case" Then
cell = grd.CurrentCell
If Not IsDBNull(cell.V alue) Then
cell.Value = UCase(cell.Valu e)
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 CellValueChange d Event I do this:

Private Sub DatagridView1_C ellValueChanged (...)Handles...
Dim s As String =
StrConv(dgrModS ubDetail.Rows(e .RowIndex).Cell s(e.ColumnIndex ).Value.ToStrin g,
VbStrConv.Upper case)
dgrModSubDetail .Rows(e.RowInde x).Cells(e.Colu mnIndex).Value = s
End Sub

The text goes to uppercase when you leave the cell.

"bo*@datasync.c om" 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.form at 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
7046
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 appear in upper case, which is what I want. But with a ComboBox, if I do this: ComboBox TCombo; this.TCombo.CharacterCasing = CharacterCasing.Upper;
5
10279
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 each text box. However if the user types the characters so fast it may not work.. Also there are some other loopholes in my code. Is there any approach in ASP.Net to make sure whenever the user types lower case, the data will be converted to upper...
3
11744
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 formatting numbers, dates, and times, though. Does the vb.net format function have a way to convert text to upper or lower case? Thanks.
1
6804
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 filter DataGridView column in order to show whatever column i want? Thanks
0
2370
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 is a ComboBox which is similar to the built-in Combo column but will hopefully be more flexible. First: I am using this control in multiple columns which _should_ hold unique items. However, the items added to column A are visible in
1
2909
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 designer allowed me to do it but when I came to run the program the designer reported an error and looking at the error messages it it confusing the datagridview column with the form on which the control resides. I can't delete the datagridviw because...
5
4506
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
2405
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 : For testing purposes, Extract data from SQL SERVER NorthWind table Products to display ProductName and UnitPrice on DataGridView and also trying to have specific DataGridView ccolumn format to suit user requirements but it's not working. Here...
1
5406
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, before update events, but nothing works! * What I have now on that specific fields is in the prpert sheet i put a ">" then it will show the text as uppercase although typed with caps lock off. - But~ It still save it as lowercase in the underlying...
0
8706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9055
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8902
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7787
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5891
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3076
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2366
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2016
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.