|
Hi all.
I am creating a program in which I used an object of background worker for searching a group of files in pc.
I am getting problem while I am trying to cancle the worker.
The code I used in a cancle button is as below :
backgroundworker1.cancleasync()
but this code is not cancling work of backgroundWorker.
Suggest me how to cancle the execution of backgroundWorker whilw there is some pending work to be done.
Thanks.
Gagan
|
|
|
|
|
Why do you think it's not cancelled ? I believe that you need inside your thread to check periodically if the thread as requested it be cancelled. That may only be true of the backgroundworker class, but it's worth looking into.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks Christian for your reply.
I continouly checking in my BackgroundWorker1_DoWork thread for its canclation but the same problem occurs.
Can you tell me some code to describe what should I do in my working thread to check for its cancelation?
Thanks.
Gagan
|
|
|
|
|
Well, I believe you need to set a property like SupportCancel for it to work at all. Then you need to check the Cancelled flag on every iteration. RunworkerCompleted is called when you cancel, so you may need to check for it there, also. Are you sure you don't just need to wait for the current file operation to end ? What is your DoWork code ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Have you looked at the documentation? it says things such as:
CancelAsync submits a request to ... (*)
When you call CancelAsync, your worker method has ... (*)
Caution:
Be aware that your code in the DoWork event handler may ... (*)
(*) Sentences cut off to make sure you learn how to search.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thanks to all of you guys
I have done the cancelation of my BackgroundWorker.
Thanks a lot.
Gagan
|
|
|
|
|
Hello every one
i kinda got my keyboard working here just have one question
how can i set the focus to whatever textbox selected or the text box that have the curser in it
Thanks everyone for you help and patients
Bob
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each ctl As Control In Me.Controls
If TypeOf ctl Is Button Then
If ctl.Text.Length = 1 Then
AddHandler ctl.Click, AddressOf btnKey_Click
End If
End If
Next
End Sub
Private Sub btnKey_Click(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Focus()
SendKeys.Send(sender.text)
End Sub
End Class
|
|
|
|
|
Hi again
The way I did it was, I made every textbox an instance of a derived class. I made my keyboard static. Whenever a textbox got the focus, it would pass itself to the keyboard ( which it could do elegantly, given that the class was all static ), and then you could also show the keyboard right away, if you wanted, on the basis that a textbox had been focused on. I also set up each textbox to know what the next textbox was, so you could use tab on the keyboard to jump between textboxes.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi
There is a problem that I want to display All employee records like treeview.
Such as:
MD
|
General Manager
|
------------------------------------------
| | | |
Production Finance Marketing Purchase
Manager Manager Manager Manager
|
--------------------------------------------
| | | |
Supervisor Incharge ABCD XYZ
Like above
Vijay Kumar S Pandey
Sector 3D, PitamPura
New Delhi
India
100034
|
|
|
|
|
Doesn't look like a problem to me. Looks like basic winforms code. We could do with knowing what your data source is, if you need help doing it. It would also help to see what you've tried. If you have no idea how to even start this task, perhaps you should pay someone to do it for you. Be careful if you place this job on sites like rentacoder tho, a lot of people bid on those jobs, even tho they are not programmers, then they post here and try to get us to do their paid work for them.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Screen Keyboard[^]
I tryed and i keepp getting a System.OutOfMemoryException was unhandled
can anyone help ??? please
Thanks
|
|
|
|
|
I don't know if it applies here, but OOM can be an indication of a bad image file.
See some of the Image or Bitmap class documentation.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
oh when it converts it over to 2008 it get error missing 7 bmp
that must be it
|
|
|
|
|
Yeah, there are no image files in the ZIP, so if the EXE needs them, you're stuck (unless you provide your own or get a response from the author!).
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I made my own image and i seen that thare is missing 2 dll the messanger api pack
and i cant find it anyware oh well
|
|
|
|
|
Hi,I am a VB.Net programmer and i want to develop a GUI chess game(computer vs human begin and human begin vs human begin)with 3D ChessPieces in VB.Net 2008 as my final year project in school. pls i want to know if u can help me with any ebook on -Guidelines on how to develop a chess game or the codes or any website i can get a vital information on chess game developing.
thanks-- McSmart
|
|
|
|
|
There's this great technology called a "search engine". Perhaps you've heard of a couple? Like Yahoo or Google?
First, I'd pick a simpler topic. Chess engines are not that easy. You'd probably be able to come up with a simple engine that just about anyone can beat.
Second, you don't have time to develop a 3D version. Keep it simple.
|
|
|
|
|
Most of these final year projects seem to consist of 'invent something that would be cool, then ask for the source code online'. That's if they get past the 'please suggest a final year project' posts that were in vogue a while ago.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yeah, I love these people that are in their "final year" but yet have absolutely no clue how to do research and teach themselves. That kind of crap makes my resume look better and better!
|
|
|
|
|
Yeah, I don't know if I should view that as a sign of job security, or a sign to get out of software while my being in here carries any value whatsoever.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
McsmartCJ wrote: Hi,I am a VB.Net programmer
Seems doubtful
McsmartCJ wrote: as my final year project in school
Seems to me that you need to both do your own research and state your sources, so that your teacher can judge how much work you did. University is not really about learning VB ( leaving aside that I would be disgusted with any uni that chose VB as a language ). languages and platforms change all the time. If your school is worth anything, it's teaching you how to learn, how to do research and how to think for yourself. Your post suggests that you have no interest in any of these things, in which case you deserve to fail. I hope that your post was just a little misguided. In which case, you should do some research and post here only when you have specific questions that don't smell like 'do my homework for me'.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
IMO a chess game consists of four parts:
- a GUI
- a move generator
- a move selector
- a chess knowledge database
Of these the GUI is the easiest part; mind you, a lot of chess games include a 3D GUI, but I always turn it off, as it hinders my view on the board, it doesn't help me a bit.
The move generator also is a simple part, except the quality of the game will depend on how FAST you generate the moves; bitarrays are a popular approach here (google for "bitarray", and I do not mean the BitArray class!)
The move selector is the hard part; that is where years of research is being spent by several companies selling chess games. Basically a lot of possible moves are considered one by one, all possible replies are considered, etc etc up to a certain depth, and then a min-max optimisation is performed; to shave of some processing time, this huge tree gets "alpha-beta" pruned. You will need detailed knowledge in all of these
in order to come up with anything half decent.
Once you got these three, you may have a program that plays a kind of chess; it may or may not be fast enough not to work on your nerves; and it will for sure play a lot of ridiculous moves...
Since finally you need a database; both the opening and the ending of the game cannot be handled well by brute force approaches; so you need a database that knows the "normal openings", as well as the typical dealing with all kinds of endgames.
Most hobbyists in this field don't spend any time in the GUI part, they tend to come up with "chess engines" (i.e. move generator + move selector) that plugs into an existing chess GUI, of which there are many available, as freeware. And almost all the value of the game in the end resides in the database.
BTW: I hope you have been playing chess for many years. What is your current ELO rating?
PS: you said it was urgent. Why is that? Did you plan something special in the next ten years?
PS2: I would never, never, consider developing a chess game in VB.NET; I definitely need all the performance I can get, so I'd go with either C, C++ or C# (with a couple of unsafe blocks for sure).
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hello,
Here is the situtation:
1 exe (acting like main menu) that launches 1-N dlls where each dll is seperate application. The exe and dlls all are sharing the same memory for the environment. We have a business requirement that if one of the applications is showing a dialog box, it cannot lock up the other running applications-ugly work around but we have accomplished this. Because N number of windows can be running at once there is a feature called, clever enough, "Show Open Windows" which when shows disables all the running forms so that the user must get rid of showopen windows before they can do anything else. While this action was not a problem, if any of those forms where showing dialogboxes then the dialog boxes were still enabled allowing the user to interact with them. I created an extension to the form to use a custom ShowDialog routine that setup an event that if the calling form's enabled problem changed then change the enabled property within the dialog box works fine.
The problem is if the parent form(one that showed the dialog) is disabled by the "show open windows" call, when it is reenabled by the showopenwindows going away, the dialog remains on top of the calling form but you can interact with the calling form - changing it's context etc. This is easily repeatable including if you use a msgbox.
Is there any value/flag that I can test for and reset to get the form back into the state where you can't interact with it until it's dialogbox goes away?
Example of the code to make this behavior happen:
'note #1: the first timer was used to check the enabled property for it's state
'note #2: the second timer disables the form 5 seconds after you click on the button to show the messagebox. 5 seconds after that the form will reenable allowing you to interact with it even though the message box is still showing.
Public Class Form1
Private _timer As Timer
Private _timerdisable As Timer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
_timer = New Timer(500)
_timer.AutoReset = True
AddHandler _timer.Elapsed, AddressOf Timer_Elapsed
_timer.Enabled = True
_timerdisable = New Timer(5000)
_timerdisable.AutoReset = True
AddHandler _timerdisable.Elapsed, AddressOf TimerDisable_Elapsed
End Sub
Private Sub Timer_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
If Me.InvokeRequired Then
Me.Invoke(New Action(Of Object, System.Timers.ElapsedEventArgs)(AddressOf Timer_Elapsed), Nothing, Nothing)
Exit Sub
End If
Me.Text = Me.Enabled.ToString & "::" & Now.ToString
End Sub
Private Sub TimerDisable_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
If Me.InvokeRequired Then
Me.Invoke(New Action(Of Object, System.Timers.ElapsedEventArgs)(AddressOf TimerDisable_Elapsed), Nothing, Nothing)
Exit Sub
End If
'----
'stop the timer so it doesn't disable the form again.
If Not Me.Enabled Then _timerdisable.Enabled = False
'-----
Me.Enabled = Not Me.Enabled
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
_timerdisable.Enabled = True
MsgBox("HEY")
End Sub
End Class
after form is disabled and then enabled you can now grab the title bar of the calling form and move it around.
Thank you
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
You could also try to create non-blocking variants of the dialogs; Show a window, set a boolean to indicate that it's showing something. When the flag gets set , attach a delegate to one of the events that fire when the form closes to reset the bool.
I are Troll
|
|
|
|
|
Thank you for replying...
"non-blocking variants of the dialogs;" - not doable... too much code would need to change to mimic the dialog behavior with the calling form.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|