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

How to disable add new records in datagrid?

frenz,
i need to disable the add new record mode in datarid.
i just want to modify the existing records in the
grid...but i dont want to add new records..how do i do
that?
-suresh
Nov 20 '05 #1
3 7079
Set the grid to read only. Or set every column to read only.

-CJ
"suresh" <su********@pvnetcop.com> wrote in message
news:04****************************@phx.gbl...
frenz,
i need to disable the add new record mode in datarid.
i just want to modify the existing records in the
grid...but i dont want to add new records..how do i do
that?
-suresh

Nov 20 '05 #2
if i set the grid into read only i coudnt edit the values
in the column.i just want to edit the column values but i
dont want to add new records..i just done this by setting
allownew = false and allowedit = true in the dataview
object and assign it to the datagrid. its working fine. i
hope this info will be useful for the future surfers.
-----Original Message-----
Set the grid to read only. Or set every column to read only.
-CJ
"suresh" <su********@pvnetcop.com> wrote in message
news:04****************************@phx.gbl...
frenz,
i need to disable the add new record mode in datarid. i just want to modify the existing records in the
grid...but i dont want to add new records..how do i do
that?
-suresh

.

Nov 20 '05 #3
Suresh,
The VB.NET DataGrid itself does not have an AllowNew property.

However the DataView object that the DataGrid ultimately gets bound to does
support an AllowNew property.

When you bind a DataGrid to a Dataset & table name (or to a DataTable) the
DataGrid uses the DataTable.DefaultView property to actually bind to.

Instead of binding to a DataSet & table name I would recommend binding to a
DataView. Associate this DataView with your DataTable from your DataSet,
then set the AllowNew property on this DataView to false. Alternatively you
may be able to change the DataView returned from DataTable.DefaultView, but
remember to change it back when you want to allow adding records...

DataView is in the System.Data namespace along with DataSet & DataTable.

Hope this helps
Jay

"suresh" <su********@pvnetcop.com> wrote in message
news:04****************************@phx.gbl...
frenz,
i need to disable the add new record mode in datarid.
i just want to modify the existing records in the
grid...but i dont want to add new records..how do i do
that?
-suresh

Nov 20 '05 #4

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

Similar topics

2
by: John R. Dougherty | last post by:
Using VB.NET: I am populating a DataTable from a SQL Server table, then associating that DataTable to a DataGrid control. I want to disallow the user from inserting new records on that DataGrid,...
0
by: Marcel | last post by:
Hi, the application I am writing has a MainMenu and a DataGrid (UltraGrid). Now I have to edit the text of each cell in this grid. So far so good. All works fine in editmode but if I press a...
0
by: Rhodri | last post by:
Hi all I have a datagrid which can display upto 20,000 records and the viewstate gets very big. I have tried turning of viewtate using EnableViewState = false both on the parent page and on the...
1
by: Geroge D. Lake | last post by:
Hi, I need to disable the resizing of a datagrid. I have tried al day and no luck. Any Ideas? Thanks. George.
1
by: johnb41 | last post by:
I have a datagrid that successfully allows editing and updating (with dataadapter.update command). I want the user to be able to edit the "text" in the datagrid, but i DON'T want the user to be...
8
by: simchajoy2000 | last post by:
I thought the only thing I had to do to disable column sorting in VB.NET was to set datagrid.AllowSorting = False. Unfortunately this has never worked for me. I discovered another set of code...
2
by: Mike | last post by:
Hi, I would like to disable sorting in a winform datagrid when a column header is clicked. The following does *not* seem to disable sorting and clicking the column header still sorts the grid:...
3
by: GhanaShyam | last post by:
Hi All, I am working on the winform datagrid. Now I have to disable the cursor movement in the datagrid using teh Arrow keys on keyboard and also I want to disable the mouse wheel (the scroll...
1
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: 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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.