Is there an instruction that I can add to a button click to exit a program

ei, you need to make a new command button then
code it like this:

formname.unload me

try using this instead.
it will unload all forms and then end all processes.

dim f as Form
for each f in forms
     unload F
     next
          end

Thanks guys...

I was having a complete brain fart day...

I also had a typo in a public variable that drove me INSANE trying to figure out why the simple program wouldn't work.

When I finally saw it I fixed it ran it once then powered down and walked away..

Some days I just create more work for myself...

Again,
Thanks...

Thank you for this. This did not however answer my original question, how to close a program. It does close a vb application that is running but I wanted to know how to close an exe file. I'll get back to you when I figure out how to do that. Thanks again.
Tduck

Lets say you wanted to close Notepad

Dim myProcess As Process = New Process
      myProcess.StartInfo.FileName = "notepad.exe"
  
        
      Case Else ' do whatever in this else
        myProcess.Kill()

Thank You!!! I'll try it out. :-)

Thank You for all the replies.

I did find what I needed, how to use a VB6 program to close another program.

It uses API commands to do it. Here's where I found the answer.

http://techrepublic.com.com/5208-6230-0.html?forumID=89&threadID=179488&start=0&tag=content;leftCol

I will go back through these posts asap.

If anybody would like to see what I'm doing, please visit my web site.

www.iconkana.com

I'm writing a computer program about learning to read and understand Japanese.

Best Wishes and Thanks Again!!!

TDuck

what is the code for calling forms?

Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1 + 0.1
If ProgressBar1.Value = ProgressBar1.Max Then
ProgressBar1.Value = ProgressBar1.Min
Else
End If
If ProgressBar1 = Max Then
Load Me
frmHellsy.Show vbmodel
End If
End Sub

i have tried this code to call that form i.e frmHellsy but its not responding.
Kindly help me.
Thanks in Advance
Hellen

'Hi Hellen,

'Not that I'm a programming wizard, but I think I know this one.
'It would be nice if I could talk with you about it to make sure that I understand
'more clearly what you mean. I need more information about why you are using the
'progress bar. If this is possible, please let me know.

'I'm in Japan. I'm not sure where you are. I do have Skype so we can talk for free but
'I'm not sure about your time zone. When we get the answer, we'll share it with Dani Web.
'My email is email snipped. My Skype ID is also nipped.

what is the code for calling forms?

Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1 + 0.1
If ProgressBar1.Value = ProgressBar1.Max Then
ProgressBar1.Value = ProgressBar1.Min
Else
End If
If ProgressBar1 = Max Then
Load Me
frmHellsy.Show vbmodel
End If
End Sub

i have tried this code to call that form i.e frmHellsy but its not responding.
Kindly help me.
Thanks in Advance
Hellen

@Hellsy, being a new member and all, please have a look at our posting rules HERE. You have hijacked TDucks post, which is not allowed.:)

@TDuck, we do not share personal information here, you have just opened yourself to spam galore!;)

Hellsy, please open a NEW thread if you want to ask a question, thanks.:)

To your problem -

Load frmHellsy
frmHellsy.Show 1 'Which is the same as vbModal

'To unload the form...
Unload Me

@TDuck, this thread has been open since 2006. If the original members answered your question, please mark this as solved, thanks.:)

Hi Dani,

I'm sorry if I Violated your rules. My message was only intended to help somebody who asked a question. That's all.

TDuck :-)

commented: Thanks for the help to others. +6

Thats no problem.:)

We were just concerned that you might fall prey to spammers by issuing your email address here. We do appreciate the help though, IF the poster is not hijacking, in this case yours, others threads. That is not allowed at all and is frowned upon deeply, especially if the thread is as old as this.;) To her defense though, she is a new member, we tend to oversee something like this once in a while.:)

Again. if you do not need any more help on your original question, please mark this as solved, found at the bottom of this page.

Happy coding.:)

This question has been answered satisfactory. Please close this thread.

<nevermind>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.