|
|
#1 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Hi!!!
I have a "main" form named MuShop and I have another form called Entrada (The SplashScreen form) in this form i've a progressbar. In MuShop Load event i'v this lines of code VB Code:
With this code the the progressbar reachs the value 100 but the textboxs are not showned correcty they stay like "invisible" (i can beyond the form). So i tried a diffenrent code: VB Code:
So anyone know a way to solve this?
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#2 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Re: SplashScreen with ProgressBar
If it's not necessary to hide the main form then show Entrada form as modelly using
<objEntrada>.ShowDialog() and if it's necessay to hide main form then simply run ByItem_() Search_() In different thread ( u can use BackgroundWorker). but to show progress u need an Inter-Thread communication .. This can be done by delegate. Lots of thread of delegate and backgroudworker is available in forum. |
|
|
|
|
|
#3 |
|
Networker
Join Date: Aug 05
Location: Sweden
Posts: 7,328
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: SplashScreen with ProgressBar
Cross-threading
I love it
__________________
---My Flickr photo stream. Have a look! Rate posts that helped you. I do not reply to PM's with coding questions. How to Get Your Questions Answered LINQ examples | Save/load a forms layout | TCP client/server connection | Retrieving the EventHandler for any Event by code. Check out the work in progress: Obtuze - A Neural Network for OCR |
|
|
|
|
|
#4 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
Hi!!!
I tried to look in forum for delegate and i'v being reding many threads but i still can figure it how can i make progressbar working and the form to be show correctly. Can anyone help me here?
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#5 |
|
Networker
Join Date: Aug 05
Location: Sweden
Posts: 7,328
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: SplashScreen with ProgressBar
Heres an example:
VB Code:
And now, instead of using: VB Code:
VB Code:
__________________
---My Flickr photo stream. Have a look! Rate posts that helped you. I do not reply to PM's with coding questions. How to Get Your Questions Answered LINQ examples | Save/load a forms layout | TCP client/server connection | Retrieving the EventHandler for any Event by code. Check out the work in progress: Obtuze - A Neural Network for OCR |
|
|
|
|
|
#6 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
It dont work I put like this:
In MainForm (MuShop): Delegate Sub dlgSetInteger(ByVal value As Integer) Private Sub SetProgressBar1Value(ByVal value As Integer) If Entrada.Principal.InvokeRequired Then Entrada.Principal.Invoke(New dlgSetInteger(AddressOf SetProgressBar1Value), New Object() {value}) Else Entrada.Principal.Value = value End If End Sub In Search_(): SetProgressBar1Value(10) In MainForm Load: Entrada.ShowDialog() ByItem_() Search_() Entrada.Close() Me.Show() Why doesnt work??!?
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#7 |
|
Networker
Join Date: Aug 05
Location: Sweden
Posts: 7,328
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: SplashScreen with ProgressBar
Do you get any errors?
__________________
---My Flickr photo stream. Have a look! Rate posts that helped you. I do not reply to PM's with coding questions. How to Get Your Questions Answered LINQ examples | Save/load a forms layout | TCP client/server connection | Retrieving the EventHandler for any Event by code. Check out the work in progress: Obtuze - A Neural Network for OCR |
|
|
|
|
|
#8 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
No But the ProgressBar (Principal) from Entrada doenst "move".
I'v notice another curious thing if i put this code: Entrada.ApplicationTitle.Text = My.Application.Info.Title Entrada.Version.Text = System.String.Format(Entrada.Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) Entrada.Copyright.Text = My.Application.Info.Copyright Entrada.ShowDialog() The ApplicationTitle.text, Version.text ... stays good but if i put this code: Entrada.ShowDialog() Entrada.ApplicationTitle.Text = My.Application.Info.Title Entrada.Version.Text = System.String.Format(Entrada.Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) Entrada.Copyright.Text = My.Application.Info.Copyright The ApplicationTitle.Text ... doens show the correct text. Why?
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." Last edited by Lasering; Jun 10th, 2006 at 11:01 AM. |
|
|
|
|
|
#9 |
|
Networker
Join Date: Aug 05
Location: Sweden
Posts: 7,328
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: SplashScreen with ProgressBar
You need to replace:
VB Code:
with: VB Code:
Because the lines underneath will not be executed unless entreda is closed, when you use showdialog. When using ShowDialog, the form behaves as a dialog, i.e it "pauses" your application until it has been closed.
__________________
---My Flickr photo stream. Have a look! Rate posts that helped you. I do not reply to PM's with coding questions. How to Get Your Questions Answered LINQ examples | Save/load a forms layout | TCP client/server connection | Retrieving the EventHandler for any Event by code. Check out the work in progress: Obtuze - A Neural Network for OCR Last edited by Atheist; Jun 10th, 2006 at 11:07 AM. |
|
|
|
|
|
#10 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
Ok i get a way of the code:
Entrada.ApplicationTitle.Text = My.Application.Info.Title Entrada.Version.Text = System.String.Format(Entrada.Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) Entrada.Copyright.Text = My.Application.Info.Copyright desapear but now when i put Entrada.show() the progressbar freezes and dont move. And if i put Entrada.Showdialog() the progressbar moves but the labels stay like transparents How can i have the progressbar and the labels working good?
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#11 |
|
Networker
Join Date: Aug 05
Location: Sweden
Posts: 7,328
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: SplashScreen with ProgressBar
wrap your code in a try statement
Like this: VB Code:
And let's see what it says.
__________________
---My Flickr photo stream. Have a look! Rate posts that helped you. I do not reply to PM's with coding questions. How to Get Your Questions Answered LINQ examples | Save/load a forms layout | TCP client/server connection | Retrieving the EventHandler for any Event by code. Check out the work in progress: Obtuze - A Neural Network for OCR |
|
|
|
|
|
#12 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Ok, I think u need a real demo.. Here i am attaching a sample..
it is without try catch block .. So, just look at the funda.. Enjoy |
|
|
|
|
|
#13 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
Hi!!!
Lool it doesn't say nothing. I put the code in MainForm Load event like this: Entrada.ShowDialog() Try ByItem_() Search_() Catch ex As Exception MessageBox.Show(ex.Message) End Try Entrada.Close() Me.Show() and no results so i tried this Try Entrada.ShowDialog() ByItem_() Search_() Catch ex As Exception MessageBox.Show(ex.Message) End Try Entrada.Close() Me.Show() Again no results. No MessageBox the progressbar dont move but the labels good. Any more ideias?
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#14 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Re: SplashScreen with ProgressBar
Have u looked at the example i attached in the previous thread ...
Call ByItem_() Search_() methods in BackgroundWorker1_DoWork event.. What u need to look at is SetHeader Method , update code to change the value of progressbar rather to change the Form's Text property. |
|
|
|
|
|
#15 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
Let me explain all again!!
I've to forms MuShop, the mainform and Entrada, the splashscreen. In Entrada i'v none code its empty it has only the labels and the progressbar called Principal. In MuShop i've a Load Event that calls the Sub Search_() and Sub ByItem_(). In Search_() Sub and in ByItem_() Sub i've this line of code Entrada.Principal.Value=Entrada.Principal.Value+10. What i want is: 1)When the program starts shows Entrada form (the splash screen) 2)The Principal (Progressbar) "moves", but for that the program will have to go to Search_() and ByItem_() 3)While the Principal moves the labels in Entrada are shown correctly 4)When the Principal.value=100 (When he finishs to read Search_() and ByItem_() the Principal.value is 100) he closes Entrada and returns to MuShop. Was i clear? If not pls tell me!!! Ops while i has editing this post u give the example lool
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." Last edited by Lasering; Jun 10th, 2006 at 12:57 PM. |
|
|
|
|
|
#16 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Re: SplashScreen with ProgressBar
Just download attachment i uploaded in 12th post of this Thread..
Anyway code with slight modification is as below.. Form1 is main Class Form2 is class having ProgressBar VB Code:
|
|
|
|
|
|
#17 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
Ok i downloaded the example. Its good but the form2 when the form1 back to the "scene" doesn't desapear!
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#18 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Re: SplashScreen with ProgressBar
Hum,
VB Code:
Btw, When next time when u add Vb code then put it inside VBCODE tags |
|
|
|
|
|
#19 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
Ok it worked!!! But ins't there a easy way to do this (if not i will use coool code, but i like a second opinion)
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#20 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Re: SplashScreen with ProgressBar
I think one day u will going to use this one then why not today .. however, If u really want some another way this is as under..
When u want to hide main form and show Form2 .. just resize main form make it smaller than Form2, set it's location beside Form2 such that user can't watch it. Change main form's location in Form2's move event .. or make Form2 Dialog and border with Fixed Size.. ReSet main form's size after closing Form2.. HOWEVER, This should only be the LAST SOLUTION if can't SOLVE IT. |
|
|
|
|
|
#21 |
|
Fanatic Member
Join Date: May 06
Location: Lisboa
Posts: 539
![]() |
Re: SplashScreen with ProgressBar
Thks Coool for the ideia but i think i came with a better one! For curious people here it goes:
In Form1 Load event i just put this Frm2.ShowDialog() In Form2 load event i put this Timer1.Start() (Timer interval = 100) Then in Timer1_Tick event i put this code: Timer1.Stop() Call Subs (In my case Search_() and ByItem_() ) Me.Close In Subs Search_() and ByItem_() i put lines like this one: ProgressBar1.Value=ProgressBar1.Value +10 (In my case ProgressBar name is Principal)
__________________
![]() ![]() ![]() Reference: MSDN Regex: Regular-Expressions.info Controls: XPCC|Code Project|Quantum|API: Api Guide Albert Einstein: "Imagination is more important than knowledge." "Everything should be made as simple as possible, but not simpler." "Great spirits have often encountered violent opposition from weak minds." |
|
|
|
|
|
#22 |
|
New Member
Join Date: Jun 06
Posts: 4
![]() |
Re: [RESOLVED] SplashScreen with ProgressBar
your problem is a matter of organizing subroutines. Just try to copy (not just call them) the ByItem_() and the other subroutine in the splash form itself and not in the MuShop form if this is possible and let these routines change the value of the prgress bar from the same form. Good???
|
|
|
|
|
|
#23 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Re: [RESOLVED] SplashScreen with ProgressBar
aloreefy .. I don't think ur idea will work fine looking at the use of Splash From .. because nce u call the subroutine on the Splash form .. it will freeze Splash Form till the completion of subroutine.. Any event like form click won't work until the process completion .. so u better to run the process that takes long time to complete on another thread.. This is the funda.
|
|
|
|
|
|
#24 |
|
New Member
Join Date: Jun 06
Posts: 4
![]() |
Re: [RESOLVED] SplashScreen with ProgressBar
What I meant Mr.Coool is to let the Splash form do something for you. Those long-time processes who run in the By_Iem and Search_() subroutines are called only once during the whole run of the program, surely, because they both affect the progress bar in the Splash form which appears only once at the start of the program (this is the normal case of any program). So why don't make the splash form do something for you??
|
|
|
|
|
|
#25 |
|
Hyperactive Member
Join Date: Feb 06
Location: System.Coool
Posts: 315
![]() |
Re: [RESOLVED] SplashScreen with ProgressBar
Ok ... As u wish, but for just once, put one button on SplashScreen Form and click it while this two methods are running .. u will come to know what i m trying to say ..
AND TELL ME IF UR CLICK RAISE ERROR OR UR PROGRAM SEEMS TO FREEZE.. |
|
|
|
|
|
#26 |
|
New Member
Join Date: Jun 06
Posts: 4
![]() |
Re: [RESOLVED] SplashScreen with ProgressBar
Dear Coool
Why put any button on a Splash screen, I mean, this is just a splash screen, an introductory form that just shows to the user till the program finishes all necessary steps while loading. So, let the splash screen finalize these steps and show the steps progress on its own progress bar. Thanks |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|