473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Data Grid in VB Dot Net

Hi
Can anyone give me the answer for the following.
Suppose there are 10 rows in datagrid, now i want to create for loop from 0th row to last row. How i can do it
Aug 23 '07 #1
4 1456
vinci
62
Hi
Can anyone give me the answer for the following.
Suppose there are 10 rows in datagrid, now i want to create for loop from 0th row to last row. How i can do it

what do u want to do in the loop?

if u just want to loop it u it this way..

Expand|Select|Wrap|Line Numbers
  1.  
  2. for i as integer = 0 to grid.rows.count-1
  3.   ' do ur stuff
  4. next
  5.  
thats how u loop thru the grid..

enjoy coding!
Aug 24 '07 #2
what do u want to do in the loop?

if u just want to loop it u it this way..

Expand|Select|Wrap|Line Numbers
  1.  
  2. for i as integer = 0 to grid.rows.count-1
  3.   ' do ur stuff
  4. next
  5.  
thats how u loop thru the grid..

enjoy coding!
Thanx
But i am not getting that .rows.count-1 in vb dot net for Datagrid
Aug 24 '07 #3
KA NMC
40
You will need a Dataset to do this I believe.

Example
Dim Mydataset as Dataset
Dim i as integer = 0

Expand|Select|Wrap|Line Numbers
  1. For i = 0 to Mydataset.Tables(0).Rows.Count - 1
  2.  
  3. Next
You can also do this with a DataRow I belive - I'm not to sure

Expand|Select|Wrap|Line Numbers
  1. Dim dr as datarow
  2. For each dr in Mydataset.Tables(0).Rows
  3.  
  4. Next

I'm actually trying to do the same thing that your doing - I'm stuck with my loop tho - I'm trying to loop thru each record to get a calculation and then placing it in a column for each record. But I'm having problems with exiting the loop. Good Luck.
Aug 24 '07 #4
vinci
62
Right!!! hahaha.. u do it using dataset...

my bad..

enjoy coding!
Aug 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jordan O'Hare | last post by:
Hello Everyone, I am after some help with the following: I have a windows application that contains a list box and two data grids. All three controls are binded to a dataset that contains...
2
by: kk | last post by:
Have 2 problems, any help is appreciated. Tab with Grids -------------- BL - fetching data from DB ( 5 secs - 10 rows) Grid Laod - 20 secs Grid Paint on tab change - 20 secs Problem: The...
5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
6
by: Hutty | last post by:
I've looked around and have yet to find anything that would answer my question regarding formating a column in a datagrid. My grid looks like this as far as data" AMHQCON|51300.01|-3147 The...
3
by: pmud | last post by:
Hi, I have a web page (asp.net, code:c#). I havean html table with text boxes. Based on the user input , records are displayed in the data grid below it. Now the datagrid has a large no. of...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
0
by: hlam | last post by:
Help - Calculating the total of a column in a data grid -- when data grid is part of Master-Detail set-up I have setup a Master-Detail form using Visual Studio.Net. A ListBox is the (Master)...
9
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New...
6
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.