|
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.
|
|
|
|
|
It's dead. MS stopped supporting it entirely.
It's been replaced, thankfully, with VB.NET. Finally! Real OOP support!
|
|
|
|
|
1 - it's dead in that it is no longer supported and will not be subject to any updates or service packs
2 - actually, the way this works in VB6 is usually that you write 2 lines of code that call a C++ COM object to do the complex stuff that VB cannot do.
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 Xandip,
I hope the code is useful...
Here is the API declaration :
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _<br />
(ByVal hwnd As Long, ByVal nIndex As Long) As Long<br />
Private Declare Function SetLayeredWindowAttributes Lib "user32" _<br />
(ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long<br />
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _<br />
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long<br />
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)<br />
<br />
Private Const GWL_EXSTYLE = (-20)<br />
Private Const LWA_ALPHA = &H2&<br />
Private Const WS_EX_LAYERED = &H80000
Here is the code where you should use :
Private Sub Command2_Click()<br />
Dim fadeCtr As Integer<br />
Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED)<br />
For fadeCtr = 255 To 0 Step -1<br />
Call SetLayeredWindowAttributes(Me.hwnd, 0, fadeCtr, LWA_ALPHA)<br />
DoEvents<br />
Call Sleep(5)<br />
Next<br />
End<br />
End Sub
Please dont use this code in Unload event of form - as you observe, I had used DoEvents in the above function. If this is useful, reply me to answer again.
|
|
|
|
|
Hi
This is my first time to use like this site
I need help in VB coding
I wont to know how I can create a VB program that read a data from a SQL database and then create and insert this data in a text file.
Regards,
jenans
|
|
|
|
|
hi..
in which part do u need help?? taking data from the tables..?? or createing and inserting the data into the textfile??
The name is Sandeep
|
|
|
|
|
Hi
for the data i will use SQL command but i wont to know how i can create and insert into the text file useing what i select in the SQL command
thank you
jenans
|
|
|
|