473,462 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Suspend Layout Problem

I'm filling a listbox with a zillion rows from a database. I'm executing a
background thread to add to the underlying DataTable so the user does not
have to wait.

The problem is this - the Listbox still seems to flicker as it is filled.
Is there a way to stop this?

Private Sub continuefilling(ByVal Thing As Object)

Do
Me.ListBox1.SuspendLayout()
Dim SQL As String = "Select top 10 ID, Account From Accounts
where ID > " + LastAccountID.ToString + " order by account"
Dim DT2 As DataTable = DB.GetDataSet(SQL).Tables(0)
If DT2.Rows.Count = 0 Then Return
LastAccountID = CInt(DT2.Rows(DT2.Rows.Count - 1)("ID"))
For Each r As DataRow In DT2.Rows
DT.ImportRow(r)
Next
Me.ListBox1.ResumeLayout()
Loop

End Sub
--
--Zorpie
Nov 21 '05 #1
2 3944
Never mind, found it myself... BeginUpdate and EndUpdate instead of
SuspendLayout...

-zorpy

"Zorpiedoman" wrote:
I'm filling a listbox with a zillion rows from a database. I'm executing a
background thread to add to the underlying DataTable so the user does not
have to wait.

The problem is this - the Listbox still seems to flicker as it is filled.
Is there a way to stop this?

Private Sub continuefilling(ByVal Thing As Object)

Do
Me.ListBox1.SuspendLayout()
Dim SQL As String = "Select top 10 ID, Account From Accounts
where ID > " + LastAccountID.ToString + " order by account"
Dim DT2 As DataTable = DB.GetDataSet(SQL).Tables(0)
If DT2.Rows.Count = 0 Then Return
LastAccountID = CInt(DT2.Rows(DT2.Rows.Count - 1)("ID"))
For Each r As DataRow In DT2.Rows
DT.ImportRow(r)
Next
Me.ListBox1.ResumeLayout()
Loop

End Sub
--
--Zorpie

Nov 21 '05 #2

Use BeginUpdate and EndUpdate instead of SuspentLayout/ResumeLayout.

HTH,

Sam
On Tue, 25 Jan 2005 12:25:02 -0800, "Zorpiedoman"
<no*********@beatles.com> wrote:
I'm filling a listbox with a zillion rows from a database. I'm executing a
background thread to add to the underlying DataTable so the user does not
have to wait.

The problem is this - the Listbox still seems to flicker as it is filled.
Is there a way to stop this?

Private Sub continuefilling(ByVal Thing As Object)

Do
Me.ListBox1.SuspendLayout()
Dim SQL As String = "Select top 10 ID, Account From Accounts
where ID > " + LastAccountID.ToString + " order by account"
Dim DT2 As DataTable = DB.GetDataSet(SQL).Tables(0)
If DT2.Rows.Count = 0 Then Return
LastAccountID = CInt(DT2.Rows(DT2.Rows.Count - 1)("ID"))
For Each r As DataRow In DT2.Rows
DT.ImportRow(r)
Next
Me.ListBox1.ResumeLayout()
Loop

End Sub


Nov 21 '05 #3

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

Similar topics

4
by: Steve | last post by:
Hi, How can I send a python script a suspend signal? I need to suspend a script that frequently updates the database so that I can do a "vacuum" on the database without affecting the script....
11
by: Keith Langer | last post by:
I have an application which consists of a main work thread and multiple threads which each maintain a TCP socket. When a configuration change occurs, all activity on the socket threads must be...
4
by: Brian Henry | last post by:
Hi, What exactly does suspend and resume layout do? the MSDN docs say "Resumes normal layout logic." but what does that mean? what is normal layout logci? and what does it change by doing this...
2
by: Sakharam Phapale | last post by:
Hi All, In following example, while playing file, if thread goes in WaitSleepJoin state, due to Thread.Sleep method. Now I want to suspend thread by clicking on cmdSuspend button. I have...
2
by: juky | last post by:
Hi all, I have a loop in the thread checking for a particular service status, whenever the status changes to "stopped" a RaiseEvent is generated by thread and another function runs. At the same...
6
by: Robert Speck | last post by:
Hi there, Can anyone shed anymore light on why "Thread.Suspend()" has been deprecated by MSFT beyond what MSDN says about it. I'm not sure if I quite appreciate the various pitfalls they discuss...
6
by: Buddy Home | last post by:
Hello, I want to understand whats the best way to write code to replace Thread.Suspend, Thread.Resume and Thread.Abort. I have lots of code calling these existing methods and want to minimize...
1
by: Mike Fellows | last post by:
Having not used threads for such a long time in vb.net I have found myself in need of them I have a thread that runs and retirieves live data from a SQL database, this is running fine and has...
3
by: CAFxX | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, I was wondering whenever it existed a method to tell browsers to suspend the layout of the page while a js function is executed. This...
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,...
1
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...
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,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.