473,320 Members | 1,870 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,320 software developers and data experts.

Datagrid.RejectChanges() problem.

Hi!
I have a datagrid containing single column.
If user adds a new word, I want to check if this word does not contain any
character except A-Z and this word doesn't exists in previous rows .
If it exists, then user should be informed and this word should not be added
to datagrid.

How should I go about it?

Nov 15 '05 #1
1 2444
Alpha,

You would need to do two things. First, I would add a constraint to the
column indicating that it is the primary key. This would prevent the column
from having duplicate values in it.

As for only allowing A-Z, that's a little harder. The DataColumn
doesn't support regular expressions. What you could do is add an event
handler for when a row is added. When it is, run the contents of the column
through the following regular expression (without quotes) "[A-Z]+". This
will allow only those characters any number of times.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Alpha Zero" <sa**********@hotmail.com> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
Hi!
I have a datagrid containing single column.
If user adds a new word, I want to check if this word does not contain any character except A-Z and this word doesn't exists in previous rows .
If it exists, then user should be informed and this word should not be added to datagrid.

How should I go about it?

Nov 15 '05 #2

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

Similar topics

2
by: Roel | last post by:
I need help to format the column and detect any change on the datagrid. My source code is: dim da as SqlDataAdapter dim ds as DataSet dim dtSource as DataTable dim conn as SQLConnection =...
2
by: Saso Zagoranski | last post by:
Hi again! I have two DataSets... I add some data to both of the dataset and the I call: dataAdapter1.Update(dataSet1); dataAdapter2.Update(dataSet2); if there is an exception in any of the...
2
by: Alex K. | last post by:
I am using datagrid bound to a datatable: DataTable dt = ...; MyGrid.DataSource = new DataView(dt); Now I am trying to intercept delete operation, when user highlights a row and presses...
7
by: DanB | last post by:
I want to asked the user if he is sure before deleting a row in a datagrid. I've created an event handler for the underlying table using the RowDeleting Event. If the user responds that he...
0
by: excelleinc.com | last post by:
Hello, I know that this question was here quite a few times but I was wondering if anyone atually found a solution/work around for it. I'm trying to prevent users from deleting certain rows in...
3
by: Geoff | last post by:
Hi Can anybody suggest how to get round the following problem? I have a form (form A for the sake of argument) which accepts data to be put into a DataTable. If the cancel button is pressed, I...
2
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
1
by: Ryan Liu | last post by:
Hi, If a DataGrid.DataSource is an IList, not a DataTable, is there a way similar to dt.AcceptChanges(), dt.RejectChanges()? Thanks a lot! Ryan Liu
0
by: gtyler | last post by:
When you make changes to a DataGrid a picture of a Pencil appears on the right hand side. As I understand it, the DataSource is not updated until you move off that row and the Pencil disappears. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.