Solved

VB 2008 - Assign a value to a DataGridView field

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

17 Experts available now in Live!

Get 1:1 Help Now