Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to populate a bound datagridview column

Posted on 2014-07-23
3
Medium Priority
?
273 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
[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
3 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 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 64

Expert Comment

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

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

722 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