473,756 Members | 4,863 Online
Bytes | Software Development & Data Engineering Community
+ 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 7112
Set the grid to read only. Or set every column to read only.

-CJ
"suresh" <su********@pvn etcop.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********@pvn etcop.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.Defau ltView 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.Defau ltView, 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********@pvn etcop.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
2066
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, but I cannot find a way to do this. Is there a way to prevent a user from inserting a new row through the DataGrid - either in the DataGrid itself, or in the original DataTable I am creating? - Thanks, JRD
0
2792
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 key which is also a shortcut it doesn´t work and the menuitem-clickevent will be performed.
0
1295
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 DataGrid itself, however when i view the generated html source there is still an enourmous viewstate. The columns for my grid are being generated dynamically in the code behind, is this causing the problem?
1
2928
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
1945
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 able to DELETE rows. The OleDbCommandBuilder automatically creates the DELETE SQL statement. Is there any way I can disable it? If not, what approach should I be using? Thanks!
8
15167
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 that seems to work for 99% of the cases where I need to disable datagrid column sorting: Private Sub datagrid_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles datagrid.MouseDown Dim pt As New Point(e.X,...
2
14869
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: After loading data into the dataset: {
3
2562
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 button) for the datagrid. Please help me in this regard. Its urgent. I will be waiting for the reply... Thanks in Advance, GS
1
7138
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 the first column in the grid only. I havent found a way to reliably do this yet. I tried putting the following code in the datagrid's mouse down event Dim hti As DataGrid.HitTestInfo
0
9152
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9716
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...
1
9716
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8569
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
7116
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
4996
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3676
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
3
2542
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.