|
-
May 11th, 2013, 08:35 AM
#1
Thread Starter
Enjoy the moment
[RESOLVED] how to refresh the listview with another form
hello
i have a listview and in trying to refresh it by showing another form that says
refreshing list please wait
tnx for the help
this is the code that call the refresh
Code:
Case 11: If LsVw.SelectedItem Is Nothing Then Exit Sub
loadentries
and the code for the refresh
Code:
Sub LoadEntries()
LsVw.ListItems.Clear
TxtFind.Text = ""
FrmCusts.MousePointer = vbHourglass
Set RS = CN.Execute("SELECT * FROM Customers ORDER BY FullName ")
TxtFind.Enabled = False
TlBar.Enabled = False
While Not RS.EOF
Set Itm = LsVw.ListItems.Add(, , RS!FullName, , "cust")
Itm.Tag = RS!ID
Itm.Bold = True
Itm.SubItems(1) = RS!Address
Itm.SubItems(2) = Format(RS!DateBirth, "dd/mm/yyyy")
Itm.SubItems(3) = RS!Facebook
Itm.SubItems(4) = RS!Email
Itm.SubItems(5) = RS!Phone
Itm.SubItems(6) = RS!Cellular
Itm.SubItems(7) = RS!HairColour
Itm.SubItems(8) = RS!Oxygen
RS.MoveNext
DoEvents
Wend
FrmCusts.MousePointer = vbNormal
TxtFind.Enabled = True
TlBar.Enabled = True
End Sub
tnx for the help
-
May 11th, 2013, 08:45 AM
#2
Re: how to refresh the listview with another form
If you are using VB6 just make the sub public and call the LoadEntries() sub from the other form or put the code in a module and do the same thing.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
May 11th, 2013, 08:51 AM
#3
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
im using vb 6
can you give me an example?
-
May 11th, 2013, 08:58 AM
#4
Banned
Re: how to refresh the listview with another form
Code:
Sub LoadEntries()
label1.caption = "Refreshing Please Wait.....
LsVw.ListItems.Clear
TxtFind.Text = ""
FrmCusts.MousePointer = vbHourglass
Set RS = CN.Execute("SELECT * FROM Customers ORDER BY FullName ")
TxtFind.Enabled = False
TlBar.Enabled = False
While Not RS.EOF
Set Itm = LsVw.ListItems.Add(, , RS!FullName, , "cust")
Itm.Tag = RS!ID
Itm.Bold = True
Itm.SubItems(1) = RS!Address
Itm.SubItems(2) = Format(RS!DateBirth, "dd/mm/yyyy")
Itm.SubItems(3) = RS!Facebook
Itm.SubItems(4) = RS!Email
Itm.SubItems(5) = RS!Phone
Itm.SubItems(6) = RS!Cellular
Itm.SubItems(7) = RS!HairColour
Itm.SubItems(8) = RS!Oxygen
RS.MoveNext
DoEvents
Wend
pause 2
label1.caption = "Loading Finished"
FrmCusts.MousePointer = vbNormal
TxtFind.Enabled = True
TlBar.Enabled = True
End Sub
Sub Pause(interval)
Dim atime
atime = Timer
Do While Timer - atime < Val(interval)
DoEvents
Loop
End Sub
-
May 11th, 2013, 09:01 AM
#5
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
what is this?
Code:
Sub Pause(interval)
Dim atime
atime = Timer
Do While Timer - atime < Val(interval)
DoEvents
Loop
End Sub
-
May 11th, 2013, 09:10 AM
#6
Re: how to refresh the listview with another form
I would not use that pause sub. Should be avoided at all costs
You could as mentioned before make the sub public and call it from the other form
Code:
Public Sub LoadEntries()
Or you could show the second form and refresh it at the top of the sub routine
Code:
Sub LoadEntries()
Form2.Show
Form2.Visible=true 'may not be needed
form2.refresh ' may not be needed ... these lines added only to insure that the form is actually displayed before the code continues on.
-
May 11th, 2013, 09:21 AM
#7
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
hey DM
the thing is that i already created another form
and i have a toolbar
that calls this procedure
Code:
Case 11: If LsVw.SelectedItem Is Nothing Then Exit Sub
here i did form1.show 1
i want the form1 to be displayed wile the backround with the listview gets refreshed
-
May 11th, 2013, 02:21 PM
#8
Re: how to refresh the listview with another form
If you are using the modal flag then you would have to call the sub from that form.
-
May 11th, 2013, 03:29 PM
#9
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
-
May 11th, 2013, 07:26 PM
#10
Re: how to refresh the listview with another form
Like I showed you in the earlier post you make the sub public and call it from the other form using formname.subname
-
May 14th, 2013, 12:29 AM
#11
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
i tried that didnt work
i just want a form to show loading wile in the backround the listview gets refreshed and when it finishes the the form loading dissapears
-
May 14th, 2013, 11:24 AM
#12
Banned
Re: how to refresh the listview with another form
check post 4 why are u making things hard for u ?
start with simple code the pause code to your project and rest code try it
then later on when u se results just remove the lables and use forms instead
-
May 14th, 2013, 02:31 PM
#13
Re: how to refresh the listview with another form
 Originally Posted by salsa31
i tried that didnt work
i just want a form to show loading wile in the backround the listview gets refreshed and when it finishes the the form loading dissapears
Show the code that you are actually using now and be more descriptive when you have a problem saying it didn't work does not tell us what went wrong
The method I showed you will work if you do it correctly. You can also place the code that loads the list on the other form in a public sub and call it from the first form
Code in your second form
Code:
Public Sub LoadList(TheList as ListView)
Me. Visible=true
Me.Refresh
' code to populate TheList
Unload Me
End Sub
-
May 14th, 2013, 02:39 PM
#14
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
this is the code when i press refresh in the form 1
Code:
Sub LoadEntries()
LsVw.ListItems.Clear
TxtFind.Text = ""
FrmCusts.MousePointer = vbHourglass
Set RS = CN.Execute("SELECT * FROM Customers ORDER BY FullName ")
TxtFind.Enabled = False
TlBar.Enabled = False
While Not RS.EOF
Set Itm = LsVw.ListItems.Add(, , RS!FullName, , "cust")
Itm.Tag = RS!ID
Itm.Bold = True
Itm.SubItems(1) = RS!Address
Itm.SubItems(2) = Format(RS!DateBirth, "dd/mm/yyyy")
Itm.SubItems(3) = RS!Facebook
Itm.SubItems(4) = RS!Email
Itm.SubItems(5) = RS!Phone
Itm.SubItems(6) = RS!Cellular
Itm.SubItems(7) = RS!HairColour
Itm.SubItems(8) = RS!Oxygen
RS.MoveNext
DoEvents
Wend
FrmCusts.MousePointer = vbNormal
TxtFind.Enabled = True
TlBar.Enabled = True
End Sub
-
May 14th, 2013, 02:40 PM
#15
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
Code:
Public Sub LoadList(TheList as ListView)
Me. Visible=true
Me.Refresh
' code to populate TheList
Unload Me
End Sub
where do i put this?
-
May 14th, 2013, 03:37 PM
#16
Re: how to refresh the listview with another form
Personally I don't care for forms that load data in other forms like this... having a "please wait" form is fine... but that's all it should do... it should be generic and do nothing more.... the form that the listview is on is what should be responsible for loading the listview.
Just my two cents.
-tg
-
May 14th, 2013, 08:07 PM
#17
Banned
-
May 18th, 2013, 10:53 AM
#18
Thread Starter
Enjoy the moment
Re: how to refresh the listview with another form
tnx all for the help
i just did frame1.caption loading...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|