Solved

VB 2008 - Assign a value to a DataGridView field

Posted on 2009-07-11
2
211 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
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now