Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Need to change datagrid cell values programatically

Posted on 2004-10-29
Medium Priority
Last Modified: 2010-04-23
On the Mouse Up event, I ask the user if they want to automatically update the values in this row.  If they say yes, I want to change various cell values and display those changes in the grid.
I assume I have to change the table and refresh the grid.  I am not getting any errors but I don't see the updates in the grid.  My dataset contains 3 tables.  The last one is the one bound to the datagrid.  Here is my code.

If Result = DialogResult.Yes Then
                Dim intRow As Integer = DataGrid1.CurrentRowIndex
                DsReqUpd14.Tables(2).Rows(intRow)(2) = Date.Today.ToString()
 End If
Question by:RuthD2004
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Assisted Solution

kGenius earned 1000 total points
ID: 12447544
Your code doesn't accept the changes.

This should be your code (I thought, haven't checked it)

If Result = DialogResult.Yes Then
                Dim intRow As Integer = DataGrid1.CurrentRowIndex
                DsReqUpd14.Tables(2).Rows(intRow)(2) = Date.Today.ToString()
                'AcceptChanges, accept the changes !!
 End If

Hope it 'll help

Accepted Solution

eozz_2000 earned 1000 total points
ID: 12448421
Or you can do this:

me.DataGrid1.Item(me.DataGrid1.CurrentRowIndex, here_the_number_of_the_column)

in here_the_number_of_the_column you can put the column number of the columns that you want to change its value:

me.DataGrid1.Item(me.DataGrid1.CurrentRowIndex, 0) = "Hello"
me.DataGrid1.Item(me.DataGrid1.CurrentRowIndex, 1) = "Bye"

in this code you will put the values "Hello" and "Bye" in the cell that you wanted, and then you can update your table.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question