Solved

VB 2008 - Assign a value to a DataGridView field

Posted on 2009-07-11
2
218 Views
Last Modified: 2012-05-07
I want to assign the value of TxtVal to the ColumnIndex field of the grid.
The error message says "Property Item is ReadOnly."  

            EvalItemsDataGridView.Columns(e.ColumnIndex) = TxtVal

TxtVal is a modified version of TxtValue from the statement earlier in the program:
           Dim TxtValue As String = e.FormattedValue
0
Comment
Question by:ljcor
[X]
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
2 Comments
 
LVL 12

Accepted Solution

by:
needo_jee earned 500 total points
ID: 24831695
hi

if you want to set text of a specific cell in GridView then you should use

 EvalItemsDataGridView.Columns(e.ColumnIndex) = TxtVal ????????  what does this means? we cant set text for a columns.. it must be either for header of a column or it must be for a single cell of a column.

to set text for a cell you should provide address of that cell

like this

Me.EvalItemsDataGridView.Rows(EvalItemsDataGridView.CurrentCell.RowIndex).Cells(EvalItemsDataGridView.CurrentCell.ColumnIndex).Value = "aa"


OR you can use this ...

        Me.EvalItemsDataGridView.CurrentCell.Value = ""



-thanks
0
 

Author Closing Comment

by:ljcor
ID: 31602449
Thanks, Needo Jee.  Very helpful.
Jack
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

729 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