|
Hello
Can you provide me a simple function of how to use Progress bar while pulling an unknown number of data from a database
thx
Regards
Ramy
|
|
|
|
|
Quite plainly, if you don't know how much data you are getting, there's no way you can show a real progress bar. You should also try to make your database call all in one go, not breaking it up into many calls if you can help it.
Your best bet is to set a progress bar to just show indeterminate progress ( the bar moves over and over ) and leave that showing while a thread does your DB call.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
ya tats right.. i had posted the same question days ago, and got the same answer from the members of this group. Any ways, try to loop the value of the progressbar with the number of recordsets you want to load. Place the function in a timer with an interval of say 1000 ms.
hope this works..
The name is Sandeep
|
|
|
|
|
Kindly,Provide me a simple code for that
thank you
Regards
Ramy
|
|
|
|
|
What he has suggested is plain not going to work. Set your progress bar Style property to Marquee and do what I said, there is just no way you can show a progress bar for an unknown number of items.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thx for ur help
I really appreciate it. ( and i m not complaining)
all what i ask is a simple code please
thx
Regards
Ramy
|
|
|
|
|
If you set the progress bar style to marquee, it will display itself automatically. Just put one on your form, and then do your database call in a thread. When the thread ends, get rid of the progress bar. I'm sorry, but I don't write VB, and really, there's no code that I can show you, you need no code for the progress bar, and I don't know how your database call is written.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thx for ur help
Regards
Ramy
|
|
|
|
|
Christian Graus wrote: I'm sorry, but I don't write VB
then start writing and THEN give your suggestions...
So whats the idea?? Changing the style of the progress bar? wats the matter if u get the count of the records that has to be processed..(as i said earlier)
Christian Graus wrote: there's no code that I can show you
but i can show you..
With flxTest
.Clear
.Rows = 1
.Cols = 5
Call GetConnection 'Function
Set Gadors = New ADODB.Recordset
GNewQuery = "SELECT * FROM test"
Gadors.Open GNewQuery, Gadocn
Gadors.MoveFirst
Dim i As Long
pg.Min = 0 'setting values of progressbar
pg.Max = Gadors.RecordCount
MousePointer = vbHourglass
While Gadors.EOF = False
i = .Rows
.Rows = .Rows + 1
.TextMatrix(i, 0) = Gadors.Fields(0)
.TextMatrix(i, 1) = Gadors.Fields(1)
.TextMatrix(i, 2) = Gadors.Fields(2)
.TextMatrix(i, 3) = Gadors.Fields(3)
.TextMatrix(i, 4) = Gadors.Fields(4)
If pg.Value <> Gadors.RecordCount Then pg.Value = pg.Value + 1
Gadors.MoveNext
flxTest.Refresh
Wend
MousePointer = vbDefault
End With
try this one....
The name is Sandeep
|
|
|
|
|
Your updating the progress bar AFTER the records have been returned, not during. Your only updaating the progress bar during the processing of each record.
For a long running stored procedure that returns a set of records, or for an unknown size of the set, this won't work at all.
|
|
|
|
|
Xandip wrote: then start writing and THEN give your suggestions...
Most of the questions here are framework questions, which is why I can answer them. I *can* write VB, but I'd prefer not to.
Xandip wrote: but i can show you..
Like Dave said, this won't work. What I explained, will.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In the case of stored procedures, I admit what Dave said. But I dont understand why you are saying to display a progressbar in the screen just for a Show sake. Whats the use of it, if it doesnt show even the approximate time taken for loading the set of records..?
The progressbar loading is used for making the user wait upto some time, till the data shows up. If its the case of stored procedures, my code can be inserted during the data loading time, because stored procedures still shows the recordcount. At least, the user can see the time spent in the data showup process.
Christian Graus wrote: What I explained, will.
I really dont like the idea of fooling a user with your 'just for show' progressbar. I admit that my idea is not the appropriate solution, but still I can't stand with yours.
The amount of time for presenting the data in front of the user can be precisely split up into the
time for data retrieval + time for data viewing
time for data retrieval -> this one, i admit, cannot be done
time for data viewing -> but you have to admit, this one can be done
The name is Sandeep
|
|
|
|
|
Is This for VB6 or VB.NET??
The name is Sandeep
|
|
|
|
|
guys
it's a vb.net application
fdbcon.Open()
fdbcmd.CommandText = "select * from table"
dr = fdbcmd.ExecuteReader
fdbcon.Open()
that is all
Regards
Ramy
|
|
|
|
|
So use the BackgroundWorker class to do this in a thread, and in it's finished event, hide the progress bar. Your only other problem is, do you also disable the rest of the UI during the call ? The easiest way to do that is have a modal call on a progress dialog, which calls the thread, and then closes itself when the call is done.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi guys..
when i close my exe, i want it to close with a fade effect..
does anyone know bout it..??
The name is Sandeep
|
|
|
|
|
Set the opacity in a loop, calling Invalidate and Application.DoEvents so they get shown, then close the form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
im using vb..
The name is Sandeep
|
|
|
|
|
If you're using VB6, you need to say so. If you're using VB.NET, then do what I said.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I cant do what u said.. coz i am using VB..
The name is Sandeep
|
|
|
|
|
|
VB 6..
The name is Sandeep
|
|
|
|
|
In VB.NET this would have been easy. In VB6, I don't think you can do it because VB6 creates its forms differently, without support for Layered Windows, which is required to support opacity.
|
|
|
|
|
OK, I can only assume when you say VB, you mean VB6. VB6 is a dead language, and it sucked to start with. If you have any choice, move to VB.NET. Otherwise, tell people you're using VB6 when you ask questions here.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Graus,
You said VB6 is a dead language. But nobody have a little experience in working with VB should'nt say like that. They would say it as the most flexible language. We can write a complex coding in other language in a very simple way in VB.
By Dileeeeeeeep.
|
|
|
|