Solved

VB 2008  - Assign a value to a non-visible Datagrid field

Posted on 2009-07-06
2
167 Views
Last Modified: 2012-05-07
My DataGridView1 has 6 column fields.  One column, uProject, has Visible set to False.  

How do I assign a value to that field.  The value is not dependent on any other field.  It is a program generated unique sequential number.  Something like: uProject = LastProject + 1.

All of the other column fields for the Row are entered by the user.

0
Comment
Question by:ljcor
2 Comments
 
LVL 4

Accepted Solution

by:
rdoran0928 earned 500 total points
ID: 24785023
I assume that you are talking about entering data for a new record.  If so, you can set the value of any column, whether visible or not as follows in DataGridView1's RowLeave event handler by doing:

DataGridView1.Item(columnIndex, DataGridView1.CurrentRow.Index).Value = uProject

or

DataGridView1.Item("columnName", DataGridView1.CurrentRow.Index).Value = uProject
0
 

Author Closing Comment

by:ljcor
ID: 31600125
OK, I'll go with that.  And thanks for the solution.
jack
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error handling in asp.net site 5 34
Iteration Help (Asp.net VB) 5 24
Code enhancement 4 22
How to open a different table using the same bindingsource - vb.net 3 36
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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