|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Stop loading data processHi
I have an application that search and load data from database and display it on the screen. because sometimes it takes too much time. I want to create a button on the search screen (like the stop button in the web browser) that will allow me to stop the searching process, gain back the focus and search for something else. How to do that...!?? the issue is that if the computer screen itself is locked during the search process!! how can the user gain back the ability to click the stop button? Cheers. Hi Badis
To achieve what you want you need to move the code that loads the data into a separate thread. It is fairly easy to do this if you are using .NET 2.0,because there is a component called BackgroundWorker. You can drop this component on a form or user control, put the data-loading control into an event called DoWork: the code will run in a separate thread. It also has a ProgressChanged event, which can be used to send progress information from the thread back to the form/control. The event argument for this event has a property called ProgressPercentage that lets the separate thread tell the form the % complete. For example, you could have a progress thermometer on the form,which could use this event to show how much of the loading process has completed. It also has a RunWorkCompleted event that fires when the code running on the separate thread has completed, and even has properties that tell you whether it ended normally, or was cancelled Hope this helped -- Show quoteHide quoteRick Hodder "Badis" wrote: > Hi > > I have an application that search and load data from database and display it > on the screen. > because sometimes it takes too much time. I want to create a button on the > search screen (like the stop button in the web browser) that will allow me to > stop the searching process, gain back the focus and search for something else. > How to do that...!?? the issue is that if the computer screen itself is > locked during the search process!! how can the user gain back the ability to > click the stop button? > > Cheers. > "RickHodder" <RickHod***@discussions.microsoft.com> wrote in message That's one approach but is hardly the only one. It's fairly easy in VB 6 tonews:44D6ECDB-7FB0-4930-9A0B-41AD931CF7F1@microsoft.com > Hi Badis > > To achieve what you want you need to move the code that loads the > data into a separate thread. use DoEvents or the related API calls to allow a button to be clicked. By setting a flag in the click event the processing routine can abort when it see the flag. -- Reply to the group so all can participate VB.Net: "Fool me once..." I'm not that familliar with APIs or DoEvents could pls be specific. A simple
code will really help. Show quoteHide quote "Bob Butler" wrote: > "RickHodder" <RickHod***@discussions.microsoft.com> wrote in message > news:44D6ECDB-7FB0-4930-9A0B-41AD931CF7F1@microsoft.com > > Hi Badis > > > > To achieve what you want you need to move the code that loads the > > data into a separate thread. > > That's one approach but is hardly the only one. It's fairly easy in VB 6 to > use DoEvents or the related API calls to allow a button to be clicked. By > setting a flag in the click event the processing routine can abort when it > see the flag. > > -- > Reply to the group so all can participate > VB.Net: "Fool me once..." > > Bob,
First of all let me apologize for giving a .NET answer in the vb classic area. I was just trying to help, and when searching through the loads of newsgroups I chose the wrong one. > That's one approach but is hardly the only one I think you misunderstood me. I didnt claim that this was the only approach. But in fact if vb6 developers move into .NET, the approach I presented is totally valid. Rick -- Show quoteHide quoteRick Hodder "Bob Butler" wrote: > "RickHodder" <RickHod***@discussions.microsoft.com> wrote in message > news:44D6ECDB-7FB0-4930-9A0B-41AD931CF7F1@microsoft.com > > Hi Badis > > > > To achieve what you want you need to move the code that loads the > > data into a separate thread. > > That's one approach but is hardly the only one. It's fairly easy in VB 6 to > use DoEvents or the related API calls to allow a button to be clicked. By > setting a flag in the click event the processing routine can abort when it > see the flag. > > -- > Reply to the group so all can participate > VB.Net: "Fool me once..." > > > First of all let me apologize for giving a .NET answer in the vb classic Hehehe...it happens. As you may have noticed, many people around here often > area. I was just trying to help, and when searching through the loads of > newsgroups I chose the wrong one. pull out various firearms and such at even the mention of the word ".NET". :) As much as I dislike VB.NET (and at the risk of getting myself ostracized and/or shot), I often wonder if we wouldn't have saved ourselves a lot of headaches by just having the VB groups be catch-alls and determining version as part of each thread (kinda like we do for VB6 vs. VB5). I can certainly see arguments against that philosophy, but I still think it might've worked out better in some ways. Ah well, what's done is done. :) Rob On Mon, 5 Mar 2007 11:25:56 -0500, "Robert Morley"
<rmor***@magma.ca.N0.Freak1n.sparn> wrote: >> First of all let me apologize for giving a .NET answer in the vb classic It would not work, quite often it is almost impossible to work out>> area. I was just trying to help, and when searching through the loads of >> newsgroups I chose the wrong one. > >Hehehe...it happens. As you may have noticed, many people around here often >pull out various firearms and such at even the mention of the word ".NET". >:) As much as I dislike VB.NET (and at the risk of getting myself >ostracized and/or shot), I often wonder if we wouldn't have saved ourselves >a lot of headaches by just having the VB groups be catch-alls and >determining version as part of each thread (kinda like we do for VB6 vs. >VB5). I can certainly see arguments against that philosophy, but I still >think it might've worked out better in some ways. Ah well, what's done is >done. :) whether a question is Fred.Net or VB Classic - it would really confuse newbies - and everyone else Anyway, they have a load of dotnet NGs - let them use them, and not foul up our play pen You have a point about the newbies, especially, and certainly since there
are already a bunch of dotnet newsgroups, I'm more than happy to keep them separate. I think it would be even better if we could simply abandon the "vb" newsgroups in favour of a set of "vbclassic" newsgroups, but I recognize the utter futility of trying to do that. :) Rob Show quoteHide quote "J French" <erew***@nowhere.uk> wrote in message news:45ed206b.3894846@news.btopenworld.com... > On Mon, 5 Mar 2007 11:25:56 -0500, "Robert Morley" > <rmor***@magma.ca.N0.Freak1n.sparn> wrote: > >>> First of all let me apologize for giving a .NET answer in the vb classic >>> area. I was just trying to help, and when searching through the loads of >>> newsgroups I chose the wrong one. >> >>Hehehe...it happens. As you may have noticed, many people around here >>often >>pull out various firearms and such at even the mention of the word ".NET". >>:) As much as I dislike VB.NET (and at the risk of getting myself >>ostracized and/or shot), I often wonder if we wouldn't have saved >>ourselves >>a lot of headaches by just having the VB groups be catch-alls and >>determining version as part of each thread (kinda like we do for VB6 vs. >>VB5). I can certainly see arguments against that philosophy, but I still >>think it might've worked out better in some ways. Ah well, what's done is >>done. :) > > It would not work, quite often it is almost impossible to work out > whether a question is Fred.Net or VB Classic > > - it would really confuse newbies - and everyone else > > Anyway, they have a load of dotnet NGs > - let them use them, and not foul up our play pen > > Robert Morley wrote:
> You have a point about the newbies, especially, and certainly since there there's a dozen or so good reasons, and in my opinion the chief among them> are already a bunch of dotnet newsgroups, I'm more than happy to keep them > separate. I think it would be even better if we could simply abandon the > "vb" newsgroups in favour of a set of "vbclassic" newsgroups, but I > recognize the utter futility of trying to do that. :) is the loss of search engine (e.g. google groups) continuity. It would be like trying to rewrite history. (not impossible, but a lot harder now that there's a worldwide Internet) Bob -- I tend to forget about google groups, but yeah, that would be another very
good reason not to. I guess the way I look at it is "in an ideal world, we could all just migrate over and there would be a minimum of problems", but I'm all too aware that the world isn't ideal. :) Rob Show quoteHide quote "Bob O`Bob" <filter***@yahoogroups.com> wrote in message news:O1%238xQCYHHA.4396@TK2MSFTNGP06.phx.gbl... > Robert Morley wrote: >> You have a point about the newbies, especially, and certainly since there >> are already a bunch of dotnet newsgroups, I'm more than happy to keep >> them separate. I think it would be even better if we could simply >> abandon the "vb" newsgroups in favour of a set of "vbclassic" newsgroups, >> but I recognize the utter futility of trying to do that. :) > > > there's a dozen or so good reasons, and in my opinion the chief among them > is the loss of search engine (e.g. google groups) continuity. > > It would be like trying to rewrite history. > (not impossible, but a lot harder now that there's a worldwide Internet) > > > Bob > -- "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message In an ideal world we'd have a migration path for VB 6.0 applicationsnews:uEqBL$CYHHA.4940@TK2MSFTNGP05.phx.gbl > I tend to forget about google groups, but yeah, that would be another > very good reason not to. I guess the way I look at it is "in an > ideal world, we could all just migrate over and there would be a > minimum of problems", but I'm all too aware that the world isn't > ideal. :) -- Reply to the group so all can participate VB.Net: "Fool me once..." Hahaha...TOO true!
Rob Show quoteHide quote "Bob Butler" <tiredofit@nospam.ever> wrote in message news:uPKGCHDYHHA.1296@TK2MSFTNGP02.phx.gbl... > "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message > news:uEqBL$CYHHA.4940@TK2MSFTNGP05.phx.gbl >> I tend to forget about google groups, but yeah, that would be another >> very good reason not to. I guess the way I look at it is "in an >> ideal world, we could all just migrate over and there would be a >> minimum of problems", but I'm all too aware that the world isn't >> ideal. :) > > In an ideal world we'd have a migration path for VB 6.0 applications > > -- > Reply to the group so all can participate > VB.Net: "Fool me once..." > Bob Butler wrote:
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message Yup. And a lot less need for separate newsgroups.> news:uEqBL$CYHHA.4940@TK2MSFTNGP05.phx.gbl >> I tend to forget about google groups, but yeah, that would be another >> very good reason not to. I guess the way I look at it is "in an >> ideal world, we could all just migrate over and there would be a >> minimum of problems", but I'm all too aware that the world isn't >> ideal. :) > > In an ideal world we'd have a migration path for VB 6.0 applications > On Tue, 6 Mar 2007 12:45:02 -0500, "Robert Morley"
<rmor***@magma.ca.N0.Freak1n.sparn> wrote: >You have a point about the newbies, especially, and certainly since there I see that you are coming round to our way of thinking>are already a bunch of dotnet newsgroups, I'm more than happy to keep them >separate. I think it would be even better if we could simply abandon the >"vb" newsgroups in favour of a set of "vbclassic" newsgroups, but I >recognize the utter futility of trying to do that. :) - which is basically to make the best of what we have got >>You have a point about the newbies, especially, and certainly since there I wouldn't say "coming round to" (partly because I'm Canadian, where we say >>are already a bunch of dotnet newsgroups, I'm more than happy to keep them >>separate. I think it would be even better if we could simply abandon the >>"vb" newsgroups in favour of a set of "vbclassic" newsgroups, but I >>recognize the utter futility of trying to do that. :) > > I see that you are coming round to our way of thinking > - which is basically to make the best of what we have got "coming *a*round to" <g>), so much as I've always acknowledged the inherent problems and just wish it could've been different. As you say, this is what we've got, so let's make the best of it. Rob Robert Morley wrote:
> I wouldn't say "coming round to" (partly because I'm Canadian, where we say shouldn't that be "coming *eh*round to"?> "coming *a*round to" <g>), so much as I've always acknowledged the inherent > problems and just wish it could've been different. As you say, this is what > we've got, so let's make the best of it. No no no, "eh" is usually used at the end of a sentence. It's become far
less common in the 90's and 00's than it used to be, though it's still used...kind of like punctuating sentences with "like". So, like, you see my point, eh? <g> Rob Show quoteHide quote "Bob O`Bob" <filter***@yahoogroups.com> wrote in message news:OTFnZDPYHHA.1300@TK2MSFTNGP02.phx.gbl... > Robert Morley wrote: > >> I wouldn't say "coming round to" (partly because I'm Canadian, where we >> say "coming *a*round to" <g>), so much as I've always acknowledged the >> inherent problems and just wish it could've been different. As you say, >> this is what we've got, so let's make the best of it. > > > shouldn't that be "coming *eh*round to"? On Wed, 7 Mar 2007 13:01:13 -0500, "Robert Morley"
<rmor***@magma.ca.N0.Freak1n.sparn> wrote: >>>You have a point about the newbies, especially, and certainly since there I think you are going to find these NGs very interesting>>>are already a bunch of dotnet newsgroups, I'm more than happy to keep them >>>separate. I think it would be even better if we could simply abandon the >>>"vb" newsgroups in favour of a set of "vbclassic" newsgroups, but I >>>recognize the utter futility of trying to do that. :) >> >> I see that you are coming round to our way of thinking >> - which is basically to make the best of what we have got >I wouldn't say "coming round to" (partly because I'm Canadian, where we say >"coming *a*round to" <g>), so much as I've always acknowledged the inherent >problems and just wish it could've been different. As you say, this is what >we've got, so let's make the best of it. - we may look like a bunch of old bigots, but there is a lot of experience around here, we tend to have individual specialities I rather suspect that we get more out of VB than most people at MS expected Yup, you do look like a bunch of old bigots, so I'll probably fit right in,
because as we all know, Access' GUI (especially the form designer) is miles ahead of VB6's <eg>, and .NET's GUI is an utter disaster, or at least it was the last time I checked it out. But I'm here for the experience, and have my own to contribute...though I don't think I would've ever come up with a one-line function to display a byte in binary format! :P Rob Show quoteHide quote "J French" <erew***@nowhere.uk> wrote in message news:45efcca0.2814526@news.btopenworld.com... > On Wed, 7 Mar 2007 13:01:13 -0500, "Robert Morley" > <rmor***@magma.ca.N0.Freak1n.sparn> wrote: > >>>>You have a point about the newbies, especially, and certainly since >>>>there >>>>are already a bunch of dotnet newsgroups, I'm more than happy to keep >>>>them >>>>separate. I think it would be even better if we could simply abandon >>>>the >>>>"vb" newsgroups in favour of a set of "vbclassic" newsgroups, but I >>>>recognize the utter futility of trying to do that. :) >>> >>> I see that you are coming round to our way of thinking >>> - which is basically to make the best of what we have got > >>I wouldn't say "coming round to" (partly because I'm Canadian, where we >>say >>"coming *a*round to" <g>), so much as I've always acknowledged the >>inherent >>problems and just wish it could've been different. As you say, this is >>what >>we've got, so let's make the best of it. > > I think you are going to find these NGs very interesting > - we may look like a bunch of old bigots, but there is a lot of > experience around here, we tend to have individual specialities > > I rather suspect that we get more out of VB than most people at MS > expected On Thu, 8 Mar 2007 11:10:04 -0500, "Robert Morley"
<rmor***@magma.ca.N0.Freak1n.sparn> wrote: >Yup, you do look like a bunch of old bigots, so I'll probably fit right in, Ah, one liners are Rick's speciality>because as we all know, Access' GUI (especially the form designer) is miles >ahead of VB6's <eg>, and .NET's GUI is an utter disaster, or at least it was >the last time I checked it out. But I'm here for the experience, and have >my own to contribute...though I don't think I would've ever come up with a >one-line function to display a byte in binary format! :P - horrible things, but he likes to show that they can be done - not that I think /anyone/ should use them in production code With VB you'll need to decide how much you want to rely on 3rd party controls - I'm strongly biased against NMH (Not Made Here) stuff I've no real feelings about .NET, although I resent the use of VB in its name and the suggestion that we are a bunch of whingers. Personally I reckon that there is a lot of life left in VB Classic, if it ceases to work in later releases of Windows then so will many other things - and that would be a problem for MS J French <erew***@nowhere.uk> wrote:
> Personally I reckon that there is a lot of life left in VB Classic, if Same opinion here, fwiw.> it ceases to work in later releases of Windows then so will many other > things - and that would be a problem for MS "RickHodder" <RickHod***@discussions.microsoft.com> wrote in message [Canned response]news:44D6ECDB-7FB0-4930-9A0B-41AD931CF7F1@microsoft.com... > It is fairly easy to do this if you are using .NET 2.0 This is a VB "classic" newsgroup. Questions (or in this case, ANSWERS!) about VB.NET (including VB 2005, which has dropped .NET from its name) are off-topic here. Please ask .NET questions in newsgroups with "dotnet" in their names. The *.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.* groups on your news server, connect directly to the Microsoft server: msnews.microsoft.com. For questions specific to the VB.NET language, use this group: microsoft.public.dotnet.languages.vb Please note that things like controls and data access, which have their own subgroups in the Classic VB hierarchy, are not language-specific in .NET, so you should look for groups like these: microsoft.public.dotnet.framework.windowsforms.controls microsoft.public.dotnet.framework.adonet (Note that "vb" is not present in the group name.) Jeff Johnson wrote:
> "RickHodder" <RickHod***@discussions.microsoft.com> wrote in message ... or supply .NET answers ...> news:44D6ECDB-7FB0-4930-9A0B-41AD931CF7F1@microsoft.com... > >> It is fairly easy to do this if you are using .NET 2.0 > > [Canned response] > This is a VB "classic" newsgroup. Questions (or in this case, ANSWERS!) > about VB.NET (including VB 2005, which has dropped .NET from its name) are > off-topic here. > > Please ask .NET questions in newsgroups with "dotnet" in their names. The Show quoteHide quote > *.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.* > groups on your news server, connect directly to the Microsoft server: > msnews.microsoft.com. > > For questions specific to the VB.NET language, use this group: > microsoft.public.dotnet.languages.vb > > Please note that things like controls and data access, which have their own > subgroups in the Classic VB hierarchy, are not language-specific in .NET, so > you should look for groups like these: > microsoft.public.dotnet.framework.windowsforms.controls > microsoft.public.dotnet.framework.adonet > (Note that "vb" is not present in the group name.) > > "Bob O`Bob" <filter***@yahoogroups.com> wrote in message See the first line. (The response was slightly "un-canned.")news:%23wItrdQXHHA.528@TK2MSFTNGP03.phx.gbl... >> [Canned response] >> This is a VB "classic" newsgroup. Questions (or in this case, ANSWERS!) >> about VB.NET (including VB 2005, which has dropped .NET from its name) >> are off-topic here. >> >> Please ask .NET questions in newsgroups with "dotnet" in their names. The > > > ... or supply .NET answers ... Jeff Johnson wrote:
Show quoteHide quote > "Bob O`Bob" <filter***@yahoogroups.com> wrote in message Oh, you're right. See what I get for recognizing and skimming?> news:%23wItrdQXHHA.528@TK2MSFTNGP03.phx.gbl... > >>> [Canned response] >>> This is a VB "classic" newsgroup. Questions (or in this case, ANSWERS!) >>> about VB.NET (including VB 2005, which has dropped .NET from its name) >>> are off-topic here. >>> >>> Please ask .NET questions in newsgroups with "dotnet" in their names. The >> >> ... or supply .NET answers ... > > See the first line. (The response was slightly "un-canned.") > > Thanks for the direction Jeff!
-- Show quoteHide quoteRick Hodder "Jeff Johnson" wrote: > "RickHodder" <RickHod***@discussions.microsoft.com> wrote in message > news:44D6ECDB-7FB0-4930-9A0B-41AD931CF7F1@microsoft.com... > > > It is fairly easy to do this if you are using .NET 2.0 > > [Canned response] > This is a VB "classic" newsgroup. Questions (or in this case, ANSWERS!) > about VB.NET (including VB 2005, which has dropped .NET from its name) are > off-topic here. > > Please ask .NET questions in newsgroups with "dotnet" in their names. The > *.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.* > groups on your news server, connect directly to the Microsoft server: > msnews.microsoft.com. > > For questions specific to the VB.NET language, use this group: > microsoft.public.dotnet.languages.vb > > Please note that things like controls and data access, which have their own > subgroups in the Classic VB hierarchy, are not language-specific in .NET, so > you should look for groups like these: > microsoft.public.dotnet.framework.windowsforms.controls > microsoft.public.dotnet.framework.adonet > (Note that "vb" is not present in the group name.) > > > Thks very much Rick, but guys; my question is in vb6.
Sorry for the stupid question, but how can I separate the loading process in a separate thread!? do you mean in a separate function!!? and how could that help if the screen itself is lock during the loading process!!!!? Show quoteHide quote "RickHodder" wrote: > Hi Badis > > To achieve what you want you need to move the code that loads the data into > a separate thread. > > It is fairly easy to do this if you are using .NET 2.0,because there is a > component called BackgroundWorker. You can drop this component on a form or > user control, put the data-loading control into an event called DoWork: the > code will run in a separate thread. > > It also has a ProgressChanged event, which can be used to send progress > information from the thread back to the form/control. The event argument for > this event has a property called ProgressPercentage that lets the separate > thread tell the form the % complete. For example, you could have a progress > thermometer on the form,which could use this event to show how much of the > loading process has completed. > > It also has a RunWorkCompleted event that fires when the code running on the > separate thread has completed, and even has properties that tell you whether > it ended normally, or was cancelled > > Hope this helped > -- > Rick Hodder > > > "Badis" wrote: > > > Hi > > > > I have an application that search and load data from database and display it > > on the screen. > > because sometimes it takes too much time. I want to create a button on the > > search screen (like the stop button in the web browser) that will allow me to > > stop the searching process, gain back the focus and search for something else. > > How to do that...!?? the issue is that if the computer screen itself is > > locked during the search process!! how can the user gain back the ability to > > click the stop button? > > > > Cheers. > >
Application crashing - trying to track down the problem.
Data Type String VB6 App Deployment in Vista Problems after installing Visual Basic 6 on XP Professional SP2 Convert decimal to fraction string Autologon on Vista Looking for an easy way to achive this problem. VB6 User Control next problem email attachments? Read/Write permission (earn your quarter, Karl!) |
|||||||||||||||||||||||