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

editing datagridview cells

8
Dim cmd As New SqlCommand(SQLSTR, conn)
reader = cmd.ExecuteReader()

Dim myDataTable As New DataTable
myDataTable.Load(reader)

If myDataTable.Rows.Count > 0 Then

datagridview1.DataSource = myDataTable
datagridview1.Columns(2).HeaderText = "QUANTITY"

datagridview1.AllowUserToAddRows = False
datagridview1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2

datagridview1.Focus()
datagridview1.CurrentCell = datagridview1(2, 0)
datagridview1.BeginEdit(True)

Else
datagridview1.DataSource = myDataTable
End If

m_reader.Close()
cmd.Dispose()

i hve the follwoing code by which i bind the data to the grid
the grid has 4 columns PRODUCTNAME, QTY,RATE, AMOUNT

the user shld be able to edit the data in the column qty for as many rows it has
but i m not able to edit this column
how do i edit the values in the cells of column(1) ie qty
Nov 11 '10 #1
1 1471
An easier way to do this would be to use the BindingSource tool. You can simply set your dataset to the BindingSource, and set your DataGrid datasource to the BindingSource, and it will automatically handle the functions that would allow a user to edit the data in the DataGrid, and you could modify it by just using the properties of the datagrid.
Nov 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: George | last post by:
Hi, I have been trying to see if I can do the following: 1. Create a DataGridView 2. Create 2 columns in the DataGridView (1 textbox and the other combobox) 3. Create a DataTable containing...
2
by: steve | last post by:
Hi All How do I get the screen coordinates of the selected cell boundaries in a datagridview I need to position a form at the top left position of the selected cell regardless of where the...
7
by: steve | last post by:
Hi All I urgently need help on setting datagridview cell borders at runtime I found some code on the web from Programming Smart Client Data Applications with .NET 2.0 by Brian Noyes See...
0
by: Mike | last post by:
Hey everyone... I've got three problems with a custom DataGridView column I've built following the "How To: Host Controls in Windows Forms DataGridView Cells" article. The base editing control...
2
by: TC | last post by:
I can't figure out how to change the background color for cells in a DataGridView. I've tried the obvious, but it doesn't seem to work: MyDataGridView.Item(1, 1).Style.BackColor =...
0
by: shahoo | last post by:
Hi, I have a DataGridView and it has a column which only accepts numbers as input. When I enter a string it prompts for an exception that the type is not correct (or something like that). Can...
2
by: veer | last post by:
hi i want to save the value which i write in the datagridview cells how can i do actually i want to insert the value into the ms acees table by writting the values in gridview cells and then...
4
by: keirnus | last post by:
Hello, Once again, I need some advices from the Access Gurus here. I have a list of data. Please refer to sample below: http://img20.imageshack.us/img20/2764/matrixd.png I need to edit...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
3
by: Parameswar Nayak | last post by:
Hi every one I am using datagridview in a win application.I need to validate the different cells according to condition like one cell for entering only numeric value. Can some one help me?
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...
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,...
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,...

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.