473,804 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagrid select all rows

how can i select all rows in a datagrid

also how can add checkbox to each of my rows in datagrid.

I tried to use DataGridColumnS tyle but failed

try

{

DataSet allCallDataSet = new DataSet();

allCallDataSet. ReadXml(xmlFile );

DataTable table = new DataTable("Hist ories");
DataColumn id = new DataColumn("Id" );

DataColumn date = new DataColumn("Dat e");

DataColumn device = new DataColumn("Dev ice");

DataColumn callId = new DataColumn("Cal lID");

DataColumn source = new DataColumn("Sou rce");

DataColumn dest = new DataColumn("Des tination");

table.Columns.A dd(id);

table.Columns.A dd(date);

table.Columns.A dd(device);

table.Columns.A dd(callId);

table.Columns.A dd(source);

table.Columns.A dd(dest);

// DataGridTableSt yle tableStyle = new DataGridTableSt yle();//
tableStyle.Mapp ingName = "Histories" ;

//

// DataGridColumnS tyle checkBox = new DataGridBoolCol umn();

// checkBox.Header Text = "Select";

// checkBox.Width = 50;

// tableStyle.Grid ColumnStyles.Ad d(checkBox);

//

// dataGrid3.Table Styles.Add(tabl eStyle);

//
DataRow row = null;

foreach(DataTab le t in allCallDataSet. Tables)

{

System.Diagnost ics.Debug.Write Line("Table name" + t.TableName);

foreach(DataRow r in t.Rows)

{

row = table.NewRow();

row["Id"] = r["Id"].ToString();

row["Date"] = r["Date"].ToString();

row["Device"] = r["Device"].ToString();

row["Date"] = r["Date"].ToString();

row["CallID"] = r["CallID"].ToString();

row["Source"] = r["Source"].ToString();

row["Destinatio n"] = r["Destinatio n"].ToString();

System.Diagnost ics.Debug.Write Line(row["Id"].ToString() + " " +
row["Date"].ToString());

table.Rows.Add( row);

}

}

allCallDataSet. Tables.Add(tabl e);

allCallDataSet. AcceptChanges() ;

dataGrid3.DataS ource = allCallDataSet. Tables["Histories"];

dataGrid3.Visib le = true;

}

catch(Exception ex)

{

MessageBox.Show (ex.Message);

return;

}
Nov 17 '05 #1
0 1805

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

Similar topics

1
2593
by: Soul | last post by:
*** I am not sure this question belong to *.languages.csharp or *.framework.windowsdorms.databinding, so I post to both *** Hi, Currently I have a DataGrid which bind to a DataSet. One of the column in the DataSet table consist of DateTime value. I also have two DateTimePicker (startDate and endDate) on my Windows form.
2
9931
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
4
3499
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a snippet from my .css file: *************************** body { margin:0; padding:0;
4
4208
by: Stan Sainte-Rose | last post by:
Hi, First, happy new year 2004 :-) I have a datagrid that displays 10 rows. I would like when I add new rows the datagrid automatically scrolls showing the 10 last rows. Currently, the new rows are added but I have to use the scroll bar to see them. Thanks for your suggestions.
5
5915
by: Genojoe | last post by:
I am using code from Help with two exceptions. (1) I increased the number of sample rows from 3 to 20, and (2) I anchored the datagrid to bottom of form so that I can change the size of the grid by changing the size of the form The code is at the following location in the January, 2004 help ms-help://MS.VSCC.2003/MS.MSDNQTR.2004JAN.1033/cpref/html/frlrfSystemWindowsFormsDataGridClassTopic.ht You can also find it by doing a search for...
1
2370
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .. http://sf-f.org, weblog and search engine for fans and writers of
4
2289
by: Jan Nielsen | last post by:
Hi all I'm a former Access developer who would like to implement a many-to-many relation in about the same way you do in Access: With a subform and a combo box. Is it possible to use a combobox in a datagrid? Any other suggestions/articles on how to implement many-many relations in the frontend (which of course are 2 one-many relations)?
0
1938
by: Matt | last post by:
I derived my own custom class from the datagrid class. I overrode the ProcessCmdKey Function, like this, to catch the up and down arrow keys: ====== Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean Const WM_KEYDOWN As Integer = &H100
2
3569
by: Flack | last post by:
Hey guys, I have a DataGrid and DataTable field in my class : private ImageDataGrid dataGrid1; //ImageDataGrid extends dataGrid and just overides OnMouseDown private DataTable dt = new DataTable("MyTable"); In the classes constructor, after InitializeComponent() I call the following
0
1309
by: Familjen Karlsson | last post by:
Hi I have downloaded some code and tried it and nothing happens with the datagrid. Explain what is wrong and what I have to do please. I have tried to Import the namespace Hamster and it didn't work. Explain what I have to do to make that work. Fia Imports System Imports System.Windows.Forms
0
9716
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
10604
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
10356
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...
0
10103
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
7644
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
6874
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
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.