473,396 Members | 1,766 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.

Grid/Combo load ..

kk
I have 2 issues, please help !
1st issue :
--------------------------------------------------------
Loading Grid
------------
1) creating new rows in a datatable and adding data a
array list to datatable.

ArrayList arrData = new ArrayList();
arrData = Employee.GetAll();

DataTable dt = new DataTable();
DataRow dr = new DataRow();
for(i=0; i< arrData.Count; i++)
{
dr = dt.NewRow();
dr["Age"] = ((Employee)arrData[i]).Age;
dr["Name"] = ((Employee)arrData[i]).Name;
dr["Object"] = arrData[i];
}

2) From datatable populating the grid
Total time taken for this is 40 secs.
Grid.DataSource = dt;

Clicking on tabs at runtime with grids in each tab
--------------------------------------------------
3) Even though the grid is loaded with data, it takes
full 20 secs for the grid to show on each tab when
switching between tabs at runtime. Grid painting is
time consuming.

2nd issue:
----------------------------------------------------------
Tried the InsertAt after the data binding and it did not
work, complained that positions for items cannot be
changed. Also tried inserting before the binding,
although there were no runtime errors, the "All" entry was
overwritten by the databinding.

public static void LoadCombo(System.Windows.Forms.ComboBox
cbo, ICollection data, string display, string key)
{
ArrayList arData = (ArrayList) data;
if (arData.Count == 0)
{
cbo.DataSource = null;
}
else
{
cbo.DataSource = arData;
cbo.DisplayMember = display;
cbo.ValueMember = key;
cbo.Items.insert(0,"All"); -- Did not work
}
-----Original Message-----

first issue... don't know. send code sample.
2nd issue - after binding add a new item.
mycbobox.Items.Insert(intPosToInsertAt,"ALL")

Nick Harris, MCSD
http://www.VizSoft.net

"kk" <an*******@discussions.microsoft.com> wrote in messagenews:03****************************@phx.gbl...
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 data fetch only takes 5 secs, why does paint and load take 40 secs in total.
Is there any reason why it is very slow.
Combo loads
-----------
Combo loaded with data binding using a collection of
business layer objects, how can we add a string
named 'ALL' to the combo box without creating an empty
object and adding it to the array collection.

Thanks,

.

..
Jul 21 '05 #1
1 2024
1. when you say dr = dt.NewRow() all your sayingis create a empty row using
the schema from this datatable. After you create the empty row, and add are
your field values, you still must add the row to the data table.

dt.Rows.Add(dr);

2. Yes grid painting is time consuming, but should be that much. In 20
seconds I can generally load and transform 4000 records. Something is up w/
your code. Use Show_plan in sql to check your sql performance. Then ensure
that tab switching isn't rebinding your grids.

3rdly, the cbo issue, i answered the other day...I've never had the issue.
I will research it. Until then why don't you just
use

arData.Add("All")
or
arData.Insert(0,"All")

so that it is in the object that is being bound?

Nick Harris, MCSD
http://www.VizSoft.net

"kk" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
I have 2 issues, please help !
1st issue :
--------------------------------------------------------
Loading Grid
------------
1) creating new rows in a datatable and adding data a
array list to datatable.

ArrayList arrData = new ArrayList();
arrData = Employee.GetAll();

DataTable dt = new DataTable();
DataRow dr = new DataRow();
for(i=0; i< arrData.Count; i++)
{
dr = dt.NewRow();
dr["Age"] = ((Employee)arrData[i]).Age;
dr["Name"] = ((Employee)arrData[i]).Name;
dr["Object"] = arrData[i];
}

2) From datatable populating the grid
Total time taken for this is 40 secs.
Grid.DataSource = dt;

Clicking on tabs at runtime with grids in each tab
--------------------------------------------------
3) Even though the grid is loaded with data, it takes
full 20 secs for the grid to show on each tab when
switching between tabs at runtime. Grid painting is
time consuming.

2nd issue:
----------------------------------------------------------
Tried the InsertAt after the data binding and it did not
work, complained that positions for items cannot be
changed. Also tried inserting before the binding,
although there were no runtime errors, the "All" entry was
overwritten by the databinding.

public static void LoadCombo(System.Windows.Forms.ComboBox
cbo, ICollection data, string display, string key)
{
ArrayList arData = (ArrayList) data;
if (arData.Count == 0)
{
cbo.DataSource = null;
}
else
{
cbo.DataSource = arData;
cbo.DisplayMember = display;
cbo.ValueMember = key;
cbo.Items.insert(0,"All"); -- Did not work
}
-----Original Message-----

first issue... don't know. send code sample.
2nd issue - after binding add a new item.
mycbobox.Items.Insert(intPosToInsertAt,"ALL")

Nick Harris, MCSD
http://www.VizSoft.net

"kk" <an*******@discussions.microsoft.com> wrote in

message
news:03****************************@phx.gbl...
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 data fetch only takes 5 secs, why does paint and load take 40 secs in total.
Is there any reason why it is very slow.
Combo loads
-----------
Combo loaded with data binding using a collection of
business layer objects, how can we add a string
named 'ALL' to the combo box without creating an empty
object and adding it to the array collection.

Thanks,

.

.

Jul 21 '05 #2

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

Similar topics

1
by: Bhom | last post by:
I am trying to create a grid on a form that looks like the 'Split Transaction' grid in Quicken - it allows drop down controls in various cells of grid to make a selection, and then stores the text...
3
by: Snake | last post by:
I have a vb .net program which fills a data grid upon form load from an acccess database. This works great. Now, I have to add a combo box and use it to alter the underlying sql statement and...
4
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be...
2
by: Brian Henry | last post by:
Hi, I have a data grid that is set up like this Page items displayed = 10 EnableViewState = false (i dont want to send large amounts of data over the internet!) CustomPaging = false...
1
by: kk | last post by:
I have 2 issues, please help ! 1st issue : -------------------------------------------------------- Loading Grid ------------ 1) creating new rows in a datatable and adding data a array...
0
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i...
0
by: surf2mail | last post by:
To anyone trying to solve the dropdown combo box navigation in a .net grid problem, here is one solution - hey, it works: We neet to trap key down and up (arrow) events and use them to navigate...
3
by: veenna | last post by:
How can i refresh datagrid in vb.net. I want to display color in one cell in grid but when it loads first time it is working here is my code Public Class Dialog_Colorazione Const YEAR_START...
1
by: pavanip | last post by:
Hi, I have a data grid control and I placed one combo box in that data grid and I am binding data to data grid combo box.When i run the application by default the combo box is not showing anything...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.