Solved

VB 2008 - Assign a value to a DataGridView field

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML - Color not displaying correctly in EMAIL. 6 49
Visual studio 2015 1 22
VS 2015 is giving [No relevant source lines] 2 30
How to repeat the data 4 20
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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