Results 1 to 12 of 12

Thread: threading

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227

    threading

    i have a program that creates two forms , it 2different threads in the sub main, but program execution ends very fast( shows forms for less than a sec , program closed), what can i do about, i dont want to use form.showdialog, any ideas?

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Post the code you are using.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    for exampe >>


    public sum main()
    dim a as new form1
    dim b as new form2
    a.show
    b.show

    ' ***i want to stop program execution here
    end sub

    these 2forms are created in 1 thread, not the main thread.
    so the Q's are..
    1.how to stop program execution after showing forms ( not using form.showdialog )
    2.if 1 form has closed , i want the thread to abort

    and a 3 q is , when a form is hidden, can it still get and recieve data?


    thanks for your time...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    anyone? anyidea?

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    A couple questions: Why do you want to do this? Why do you not want to use ShowDialog?

    Maybe there is another way to do what you want.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    i have a tcpclient object that connects to a server, on the client there is 2 forms, when a is shown b should be hidden, and when b is shown a should be hidden? both forms get data from the tcpclient

    what i'm doing is having the tcpclient in the main thread, then having another thread for the 2 forms

    i dont want to use showdialog, because when doing so i had problems when hiding and showing


    what do you think? any other better ways?
    Last edited by persianboy; Oct 12th, 2003 at 02:22 AM.

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    So why do the forms have to be on seperate threads? I would make one form showdialog or Application.Run and the other show from it. The should still hide/show fine.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    so what you mean is have everything in 1 thread,right?!

  9. #9
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes. I don't understand why you need two threads. you can show and hide with 1 in fact its easier with one.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    thanks man, i'll start rewriting it in one thread

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    by the way, whats the differance between showdialog and application.run ?!?

    thansk for your time....

  12. #12
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    ShowDialog just shows the form modally, which if used in sub main then this will halt execution until it is closed. Application.Run assigns the form as belonging to the Main or UI thread, which if done in sub main will mean that the entire app will close with the form.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width