473,461 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 7092
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.