473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

DatagridTextBoxColumn- max length

How Can I set the max length in the datagrid ?
Thanks
Nov 20 '05 #1
3 3099
I know how to set the max length for the datatable.
dtInvoice.columns.item("description").maxlength = 40

However, the effect as not good as textbox.
The user can input the 50 charactrers, as he/she press 'enter', there is a
messagebox prompt out.
I think it is not good for the user.. Any other idea ?

"Agnes" <ag***@dynamictech.com.hk> ¦b¶l¥ó
news:%2****************@TK2MSFTNGP10.phx.gbl ¤¤¼¶¼g...
How Can I set the max length in the datagrid ?
Thanks

Nov 20 '05 #2
Hi Agnes,

All you ever wanted to know about the datagrid.

http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp

I hope this helps?

Cor
Nov 20 '05 #3
Hi,

Here is a class that inherits from a datagridtextboxcolumn that should
work.

Public Class MaxLengthColumn
Inherits DataGridTextBoxColumn

Private mintLen As Integer = 256

Public Property MaxLength() As Integer
Get
Return mintLen
End Get
Set(ByVal Value As Integer)
mintLen = Value
End Set
End Property

Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal
bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal
instantText As String, ByVal cellIsVisible As Boolean)
MyBase.Edit(source, rowNum, bounds, [readOnly], instantText,
cellIsVisible)
MyBase.TextBox.MaxLength = mintLen
End Sub
End Class
Ken
-------------------

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:#t**************@TK2MSFTNGP12.phx.gbl:
I know how to set the max length for the datatable.
dtInvoice.columns.item("description").maxlength = 40

However, the effect as not good as textbox.
The user can input the 50 charactrers, as he/she press 'enter', there is a

messagebox prompt out.
I think it is not good for the user.. Any other idea ?

"Agnes" <HYPERLINK
"mailto:ag***@dynamictech.com.hk"ag***@dynamictech .com.hk> &b6l%s
news:%2****************@TK2MSFTNGP10.phx.gbl $$<6<g...
How Can I set the max length in the datagrid ?
Thanks


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #4

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

Similar topics

2
by: Job Lot | last post by:
I am customizing DataGridTextBoxColumn. How can I access properties in DataGrid to which custom DataGridTextBoxColumn will be added. Say for instance, how I would access SelectionBackColor...
0
by: DraguVaso | last post by:
Hi, I 'wrote' my own DataGrid, using the normal DataGrid, and overriding some of the DataGridTextBoxColumn-methods (mostly the Paint-method). I based most of my changes on the Windows Form FAQ:...
0
by: Mike Burkhart | last post by:
I have written the following class to build a data grid textbox column that has the KeyUp and KeyPress events defined for the TextBox. I also defined the KeyDown event for testing purposes only. ...
1
by: Jaco Karsten | last post by:
I am writing a customized DataGrid control which will allow the user to only select an entire row (and not a cell inside the row). So I want to add readonly columns to the datagrid. To achieve...
2
by: Pietje de kort | last post by:
Hello all, currently I am building a customized DataGridTextBoxColumn class. I wish to override the GetMinimumHeight() method. I think this method is being called by the DataGrid for each cell...
0
by: Jax | last post by:
I am using a class that inherits from the DataGridTextBoxColumn. It adds a combo box into the column where it displays a selection of choices. The problem I have is that when this comboBox loses...
1
by: Sangeetha | last post by:
I have a datagrid column which I want to expand when i type in some text. Initially I tried increasing the column width on the key down event of that DataGridTextBoxColumn, but it didn't work out as...
0
by: Alex K. | last post by:
from inside a DataGridTextBoxColumn object, how do I get reference to DataGrid control? Or to its DataSource property? Thank you
0
by: JMarques | last post by:
I have one DataGrid with one column colPWD, and the code DataGridTableStyle dgStyle = new DataGridTableStyle(); DataGridTextBoxColumn colPWD = new DataGridTextBoxColumn(); colPWD.MappingName =...
5
by: Datagridtextboxcolumn not firing event | last post by:
"PLEASE HELP, I NEED HELP N O W !!!" AddHandler dgtxtboxcolumn.textbox.KeyDown, AddressOf TextBoxKeyPress Private Sub TextBoxKeyPress(ByVal sender as Object, ByVal e as KeyEventArgs) End...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.