?
Solved

VB 2008 - Assign a value to a DataGridView field

Posted on 2009-07-11
2
Medium Priority
?
220 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:
Munawar Hussain earned 2000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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