Click here to Skip to main content
15,896,557 members
Home / Discussions / C#
   

C#

 
GeneralRe: slow listview refresh Pin
afinnell18-Oct-04 6:17
afinnell18-Oct-04 6:17 
GeneralRe: slow listview refresh Pin
Heath Stewart18-Oct-04 6:46
protectorHeath Stewart18-Oct-04 6:46 
GeneralRe: slow listview refresh Pin
afinnell18-Oct-04 7:50
afinnell18-Oct-04 7:50 
GeneralRe: slow listview refresh Pin
Heath Stewart18-Oct-04 10:06
protectorHeath Stewart18-Oct-04 10:06 
GeneralRe: slow listview refresh Pin
afinnell18-Oct-04 11:11
afinnell18-Oct-04 11:11 
GeneralRe: slow listview refresh Pin
Heath Stewart18-Oct-04 11:41
protectorHeath Stewart18-Oct-04 11:41 
GeneralRe: slow listview refresh Pin
afinnell18-Oct-04 12:03
afinnell18-Oct-04 12:03 
GeneralRe: slow listview refresh Pin
DF_Bandit18-Oct-04 8:16
DF_Bandit18-Oct-04 8:16 
Thanks Heath,

I am not sure if the data are being gathered on another thread, so I altered my code to use a delegat data formater and used the listview's Invoke method. So the code looks like this:
		<br />
protected void LoadLogList()<br />
{<br />
...<br />
SqlCommand		m_sqlCmd = new SqlCommand( "DF_Get_DayLog_List",<br />
MainForm.Instance.FDSConnection.DBConnection.Connection );<br />
<br />
m_sqlCmd.CommandType = CommandType.StoredProcedure;<br />
m_sqlCmd.Parameters.Add("@DF_TrafficID", iTrafID );<br />
<br />
SqlDataReader reader = m_sqlCmd.ExecuteReader();<br />
<br />
myMethodDelegate myD1 = new myMethodDelegate( this.LoadLogItem );<br />
object[] param = {reader};<br />
<br />
while( reader.Read() )<br />
{<br />
	lvwLogDays.Invoke(myD1, param);<br />
}<br />
<br />
reader.Close();<br />
	<br />
}<br />
<br />
public void LoadLogItem(SqlDataReader reader)<br />
{<br />
	DateTime Date = reader.GetDateTime( reader.GetOrdinal( "LogDate" ) );<br />
	string strTemp = Date.ToString( "MM/dd/yyyy" );<br />
	OpenDayLogData	DayLogData = new OpenDayLogData();<br />
<br />
	ListViewItem item = lvwLogDays.Items.Add( strTemp );<br />
<br />
	strTemp = reader["LogStatus"].ToString().Trim();<br />
	item.SubItems.Add( strTemp );<br />
<br />
	DayLogData.LogID = Convert.ToInt32(reader["DF_LogID"].ToString(), 10);<br />
	DayLogData.LogDayID = Convert.ToInt32(reader["DF_LogDayID"].ToString(), 10);<br />
	item.Tag = DayLogData;<br />
}<br />


I experienced no speed change. Am I being unreasonable to expect 500 lines to be loading into the list view in much less than Sleepy | :zzz: 10 seconds (on a 2.x GHz P4 machine, lots of RAM - nothing else - much - going on)?
GeneralSplitter &amp; multiple panels Pin
DennisMetz15-Oct-04 6:47
DennisMetz15-Oct-04 6:47 
GeneralRe: Splitter &amp; multiple panels Pin
Stanciu Vlad15-Oct-04 7:42
Stanciu Vlad15-Oct-04 7:42 
GeneralRe: Splitter &amp; multiple panels Pin
DennisMetz15-Oct-04 8:14
DennisMetz15-Oct-04 8:14 
GeneralRe: Splitter &amp; multiple panels Pin
Heath Stewart15-Oct-04 9:02
protectorHeath Stewart15-Oct-04 9:02 
GeneralRe: Splitter &amp; multiple panels Pin
DennisMetz15-Oct-04 9:44
DennisMetz15-Oct-04 9:44 
GeneralLittle Help pls Pin
alphanorm15-Oct-04 6:31
alphanorm15-Oct-04 6:31 
GeneralRe: Little Help pls Pin
Brian Nottingham15-Oct-04 6:49
Brian Nottingham15-Oct-04 6:49 
GeneralRe: Little Help pls Pin
alphanorm15-Oct-04 6:55
alphanorm15-Oct-04 6:55 
GeneralDisplaying AOL .art file Pin
cgcrute15-Oct-04 5:05
cgcrute15-Oct-04 5:05 
GeneralRe: Displaying AOL .art file Pin
Heath Stewart15-Oct-04 6:26
protectorHeath Stewart15-Oct-04 6:26 
GeneralRe: Displaying AOL .art file Pin
cgcrute15-Oct-04 6:55
cgcrute15-Oct-04 6:55 
GeneralRe: Displaying AOL .art file Pin
Heath Stewart15-Oct-04 7:05
protectorHeath Stewart15-Oct-04 7:05 
GeneralRe: Displaying AOL .art file Pin
cgcrute15-Oct-04 7:20
cgcrute15-Oct-04 7:20 
GeneralRe: Displaying AOL .art file Pin
cgcrute11-Apr-05 11:04
cgcrute11-Apr-05 11:04 
GeneralRe: Displaying AOL .art file Pin
Heath Stewart12-Apr-05 8:15
protectorHeath Stewart12-Apr-05 8:15 
GeneralRe: Displaying AOL .art file Pin
cgcrute12-Apr-05 8:37
cgcrute12-Apr-05 8:37 
Generalconstant WM_PAINT messages Pin
jcl55515-Oct-04 5:00
jcl55515-Oct-04 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.