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
In ByItem and in Search subs i'v loops and other code that increase the progressbar value(from Entrada).
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:
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."
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.
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.
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."
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()
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."
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?
Last edited by Lasering; Jun 10th, 2006 at 10:01 AM.
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."
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?
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."
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.
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."
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.
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
Last edited by Lasering; Jun 10th, 2006 at 11:57 AM.
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."
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."
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."
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.
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)
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."
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???
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.
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??
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..
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.