I want to open a window (the called window) - and perhaps run a progressbar,
etc - from a calling window's load event. The calling window is loading a
large datatable before it completes its load event.
The calling window itself is a child window in an mdi app. I'm having a
terrible time trying to do this, as the called window never fully opens
unless it's called via showdialog, but this is not what I want, because I
want it to close when the progressbar completes (or when the calling window
finally loads, which is the same thing).
Thanks for any help.
Bernie Yaeger 2 1135
Hi Bernie,
I would make a seperate thread to load that dataset, and not succeed in
getting that fill to give information use "on and off" gif's that are
changed from throwed events every 5 seconds in the the thread.
I have here pasted some code that Armin did made for this, I still did not
check it, but I think it is a good start for your question.
And before you ask it, you can kill a thread with "myThread.abort"
I hope you a little bit?
Cor
\\\By Armin Zingler
In a new project, add a button to the Form. Also add the following code:
Private m_Thread As MyThread
Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
m_Thread = New MyThread
AddHandler m_Thread.Progress, AddressOf OnProgress
AddHandler m_Thread.Done, AddressOf OnDone
m_Thread.Start()
End Sub
Public Delegate Sub ProgressDelegate(ByVal Progress As Integer)
Private Sub OnProgress(ByVal Progress As Integer)
If Me.InvokeRequired Then
Me.Invoke(New ProgressDelegate( _
AddressOf OnProgress _
), New Object() {Progress})
Else
Me.Button1.Text = Progress.ToString
End If
End Sub
Private Sub OnDone()
m_Thread = Nothing
End Sub
////
Class MyThread
Public Event Progress(ByVal Progress As Integer)
Public Event Done()
Private m_Thread As Thread
Public Sub Start()
m_Thread = New Thread(AddressOf ThreadStart)
m_Thread.Start()
End Sub
Private Sub ThreadStart()
Dim i As Integer
For i = 1 To 100
Thread.Sleep(100)
RaiseEvent Progress(i)
Next
RaiseEvent Done()
End Sub
End Class
///
Hi Cor,
Thanks very much. I will be testing this code today.
Thanks again,
Bernie
"Cor" <no*@non.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl... Hi Bernie,
I would make a seperate thread to load that dataset, and not succeed in getting that fill to give information use "on and off" gif's that are changed from throwed events every 5 seconds in the the thread.
I have here pasted some code that Armin did made for this, I still did not check it, but I think it is a good start for your question.
And before you ask it, you can kill a thread with "myThread.abort"
I hope you a little bit?
Cor
\\\By Armin Zingler In a new project, add a button to the Form. Also add the following code:
Private m_Thread As MyThread
Private Sub Button1_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles Button1.Click
m_Thread = New MyThread AddHandler m_Thread.Progress, AddressOf OnProgress AddHandler m_Thread.Done, AddressOf OnDone m_Thread.Start() End Sub
Public Delegate Sub ProgressDelegate(ByVal Progress As Integer)
Private Sub OnProgress(ByVal Progress As Integer) If Me.InvokeRequired Then Me.Invoke(New ProgressDelegate( _ AddressOf OnProgress _ ), New Object() {Progress}) Else Me.Button1.Text = Progress.ToString End If End Sub
Private Sub OnDone() m_Thread = Nothing End Sub //// Class MyThread Public Event Progress(ByVal Progress As Integer) Public Event Done()
Private m_Thread As Thread
Public Sub Start() m_Thread = New Thread(AddressOf ThreadStart) m_Thread.Start() End Sub
Private Sub ThreadStart() Dim i As Integer For i = 1 To 100 Thread.Sleep(100) RaiseEvent Progress(i) Next RaiseEvent Done() End Sub
End Class /// This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Clinton Goff |
last post by:
I am attempting to write a javascript app that will open a second browser
window, load a url, such as www.google.com (foreign url) and perform a
<File-Save As> function on that window. I am able...
|
by: Mehmet Gunacti |
last post by:
Hello,
on our homepage, when pressing an anchor tag, a special sized popup
window opens via javascript. but it opens very slowly.
on other web pages, there are also javascript-opened windows,...
|
by: GEL |
last post by:
Hi, I want to open a new browser window, let the user use that window
for several minutes, and when they close, I'd like to change the page
displayed in the original window.
According to...
|
by: D. Alvarado |
last post by:
Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a...
|
by: VM |
last post by:
When I try to open a window (this small window is 198x190 in size) through
the MDI menu with:
frm_export frmExport = new frm_export();
frmExport.MdiParent = this;
frmExport.Show();
it opens...
|
by: Jack Addington |
last post by:
I have a 'quickadd' type window for doing quick data entry. The window is
launch from a MDI child and is suppose to be a re-sizable popup/child
window. This is an excel type datagrid for doing...
|
by: John Smith |
last post by:
I need to:
a) Close a windows form from within the form's code itself
b) It must be able to occur after the form's constructor function is called
(like from another function that's called before...
|
by: Daz |
last post by:
Hello everyone,
I would like to open a child window from the parent, and add an onload
event listener to the child window which will tell the parent when the
document has loaded. As far as I...
|
by: hemsla29 |
last post by:
Open1.Attributes.Add("onclick", "window.open('" + path + "' ); return false;")
i am using an button name open1 while clicking i have to do some process and have to open the processed file in...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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: 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...
| |