473,837 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display DataTable content reversely

Hello.

I want to display the content of 'displayTable' object reversely.
When from r=0 to r= displayTable.Le ngth-1, the code works well to display.
But when from r= displayTable.Le ngth-1 to r=0, the code doesn't work to
display.

Thanks a lot for any help.

**********
DataRow[] displayTable = resultTb.Select ();
....
//for (int r = 0 ; r < displayTable.Le ngth ; r++ ) // works well.
//for (int r = 6 ; r < -1 ; r = r-1 ) // doesn't work
for (int r = displayTable.Le ngth-1 ; r < -1 ; r--) // doesn't work
{
...
buttonNm = displayTable[r].ItemArray.GetV alue(3).ToStrin g().Trim();
this.openButton = new System.Windows. Forms.Button();
this.Controls.A dd(this.openBut ton);
...
}
*************
Have a nice day.

Eunice.
Nov 17 '05 #1
2 2750
Hello,
revise the for loop. it says that the statements will only execute
when r will be less than -1. I hope you wanna use it like this:
for (int r = displayTable.Le ngth-1 ; r > -1 ; r--)

HTH. Cheers.
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #2
Hi,
I dont see any problem in your code. Except
Replace:for (int r = displayTable.Le ngth-1 ; r < -1 ; r--)

with: for (int r = displayTable.Le ngth-1 ; r > -1 ; r--)

It should be r>-1.
"Eunice" wrote:
Hello.

I want to display the content of 'displayTable' object reversely.
When from r=0 to r= displayTable.Le ngth-1, the code works well to display.
But when from r= displayTable.Le ngth-1 to r=0, the code doesn't work to
display.

Thanks a lot for any help.

**********
DataRow[] displayTable = resultTb.Select ();
...
//for (int r = 0 ; r < displayTable.Le ngth ; r++ ) // works well.
//for (int r = 6 ; r < -1 ; r = r-1 ) // doesn't work
for (int r = displayTable.Le ngth-1 ; r < -1 ; r--) // doesn't work
{
...
buttonNm = displayTable[r].ItemArray.GetV alue(3).ToStrin g().Trim();
this.openButton = new System.Windows. Forms.Button();
this.Controls.A dd(this.openBut ton);
...
}
*************
Have a nice day.

Eunice.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
3357
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those columns, "scode" and "sname", as 1 column (if not possible then 2 columns will be fine) in the listbox. Can the listbox display 2 columns information from the dataset and how can I do that? Also, I set the property of the listbox to selectionmode...
1
1439
by: Danny Ni | last post by:
Hi, Is there a way to selectively display content of a DataGrid or DataList? Normally I bind them to datareader or datatable, and they will display all the rows, what if I don't want to display some of the rows. Please don't tell me get rid of the rows from datareader or datatable, that's not the answer I am looking for. TIA
1
2027
by: cindy | last post by:
Get data into datatable, add to dataset dsSearch " Get data into datatable, add to dataset dsSearch Using In-Memory SQL Engine join the tables and select the filenames from the join, add to dataset dsSearch CODE ON http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3994&lngWId=10 using SQL connection get data from view on sql server, add to dataset dsSearch
2
12026
by: j.m.osterman | last post by:
I haven't found exactly what I've been trying to do. All I am trying to do for now is just display usernames from Active Directory into a ListBox control on a page. I have found some code however that will just capture a Full Name from Text Box and display information from the Active Directory into a DataTable. I will display that code below.
11
35433
by: inpuarg | last post by:
I have 2 datatables. They are identical. I want to compare them by cell's content. They are all same. But dt1 == dt2 or dt1.GetHashCode() == dt2.GetHashCode() doesn 't work. There are big amount of rows in theese datatables . So i don 't want to enumerate each rows. This is not efficient and unacceptable for my current application.
6
2054
by: Ken Fine | last post by:
I'm using SQLDataSource, which generates some kind of dataset, and then I attach that datasource to various data display controls such as DataList and repeater which loop through to the end of the data that was retrieved by the query. At times I may want the display control only to render some items in the set of data returned by SqlDataSource. There would be several scenarios: * render the second data item or third item in to the end...
2
1529
by: krajah | last post by:
Need Help Here....... I'm using visual C#: How to insert the value that user have entered combobox and click button.The value will sent into database.This is in form1. In form2,if click button it will display in listbox.There also got another button to to delete the value according the index have chose using cursour. I'm using sql server 2005,the were connection problem.How to know the server name for my computer. Below is the coding I...
0
2324
parshupooja
by: parshupooja | last post by:
Contact Reply 1 point Member propoo Joined on 08-31-2007, 10:32 PM Posts 3 Hey all ,
2
3689
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos of these records will be displayed in a combobox, say item1, item2, etc.. then,i have a datagrid...
0
9839
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10564
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10621
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10268
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7806
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6998
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5846
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.