Solved

How to populate a bound datagridview column

Posted on 2014-07-23
3
261 Views
Last Modified: 2014-07-24
Software: vb.net & sql server 2005

I need sample code to populate a bound datagridview column with values 1 thru 10 on form load.

Thanks!
0
Comment
Question by:dave_sky
  • 2
3 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 40215334
Hi Dave;

You can use code like the following to do what you need.
'' The value to be inserted
Dim value As Integer = 1

'' Change the string "TheValue" to be the actual name of the column to be
'' pre-filled.
For i As Integer = 0 To DataGridView1.RowCount - 1
    DataGridView1.Rows(i).Cells("TheValue").Value = value.ToString()
    value += 1
Next

Open in new window

0
 

Author Closing Comment

by:dave_sky
ID: 40215708
Thanks Fernando
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 40216908
Not a problem Dave, glad to help.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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…
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.
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…

770 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