473,396 Members | 2,011 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,396 software developers and data experts.

Code to Invert a Datagrid

Hope this helps...

public void InvertDS(ref DataSet ds)
{
try
{
DataSet ds2 = new DataSet();
ds2.Tables.Add();
ds2.Tables[0].Columns.Add();
ds2.Tables[0].Columns.Add();

for(int i=0; i < ds.Tables[0].Columns.Count; i++)
{
object [] array = new object[2];
array[0] = ds.Tables[0].Columns[i].ColumnName;
array[1] = ds.Tables[0].Rows[0][i];
ds2.Tables[0].Rows.Add(array);
}

ds = ds2;
}
catch(Exception ex)
{
string s = ex.ToString();
}
}

Jul 15 '06 #1
0 1185

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

Similar topics

10
by: Des Small | last post by:
Lately I have found myself using a pattern to make new dictionaries quite often, by which I mean twice: def invert(d): nd = {} ).append(key) for k, v in d] return nd def count(l): d = {}
5
by: Me Padre | last post by:
Hoping someone can help with this. I know I can do this programatically using a loop but I thought there might be some easier or more effective way. I am trying to invert an array. i.e. ...
3
by: Peter Aitken | last post by:
I want to invert all the bits (all 0s to 1s, all 1s to 0s) in a type ushort. I though I would use the complement operator ~ but the compiler won't buy it. How can I do this? Thanks, --...
4
by: Derek Martin | last post by:
Hi List, I have an arraylist of objects. I have created my own IComparable in the object to return the sort on datetime. This works great! Now, I'd like to invert the sort. Currently, it gives...
10
by: rtilley | last post by:
s = list('some_random_string') print s s.reverse() print s s = ''.join(s) print s Surely there's a better way to do this, right?
41
by: rick | last post by:
Why can't Python have a reverse() function/method like Ruby? Python: x = 'a_string' # Reverse the string print x Ruby: x = 'a_string' # Reverse the string
2
by: billelev | last post by:
In other languages it's possible to prefix a boolean with a "!" to invert it, however this doesn't seem to work in VBA. Is there an alternative in VBA? I'd like the flexibility to do something...
0
by: artistlikeu | last post by:
dear all, i have an array which has some elements. I want to invert the sequence of elements.i.e i want that last number of array should become first number and vice versa. thnx @rtist
1
by: mahesh.nimbalkar | last post by:
Hi, I have color as System.Drawing.Color c1 object as background color. Now I would like to get another System.Drawing.Color c2 object which is invert of c1 color to be used as foreground...
2
by: Stef Mientki | last post by:
hello, from the manual I read that a bitwise inversion should be done by invert. But from some experiments I see that not works equally well. Is this coincidence ? (The disadvantage of invert...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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...

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.