Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-07-06
2
Medium Priority
?
171 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

885 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