[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Shutdown using 2 variables

Posted on 2004-11-17
6
Medium Priority
?
215 Views
Last Modified: 2010-04-24
i have 2 listbox's, a radiobutton, and an "execute" button.

so far i have, the user can designate a time period for their computer to shutdown, if you look in your command prompt you can include a comment on the shutdown. "-c". i want textbox2 to be able to determine what the user wants to write as the comment on the shutdown.

If RadioButton1.Checked Then Shell("shutdown -s -f -t " & TextBox1.Text)
0
Comment
Question by:asherap
  • 3
  • 3
6 Comments
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 400 total points
ID: 12602540
like this

Shell("shutdown -s -f -t " & TextBox1.Text & " -c " & TextBox2.Text)
0
 

Author Comment

by:asherap
ID: 12602744
yeah taht works perfectly, but the only thing is if i dont have a comment i cant even do a shutdown normally
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12602763
Well do a check beforehand then, like

if textbox2.text = "" then
      Shell("shutdown -s -f -t " & TextBox1.Text)
else
      Shell("shutdown -s -f -t " & TextBox1.Text & " -c " & TextBox2.Text)
endif
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:asherap
ID: 12603229
ok i will show u what code i have so far and can you rewrite what i will need
p.s i have upped the point value 50

If TextBox2.Text = "" Then
            Shell("shutdown -s -f -t " & TextBox1.Text)
        Else
            Shell("shutdown -s -f -t " & TextBox1.Text & " -c " & TextBox2.Text)
        End If

        If RadioButton1.Checked Then Shell("shutdown -s -f -t " & TextBox1.Text & " -c " & TextBox2.Text)
        If RadioButton2.Checked Then Shell("shutdown -r -f -t " & TextBox1.Text & " -c " & TextBox2.Text)


problem is still if i dont enter a comment it doesn work
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12603243
      If TextBox2.Text = "" Then
          If RadioButton1.Checked Then Shell("shutdown -s -f -t " & TextBox1.Text)
        Else
            If RadioButton2.Checked Then Shell("shutdown -r -f -t " & TextBox1.Text & " -c " & TextBox2.Text)
        End If

       
0
 

Author Comment

by:asherap
ID: 12613398
thanks but i had to modify the code a little bit to suit my program it ended up being,

If TextBox2.Text = "" Then
            If RadioButton1.Checked Then Shell("shutdown -s -f -t " & TextBox1.Text)
            If RadioButton2.Checked Then Shell("shutdown -r -f -t " & TextBox1.Text)
        Else
            If RadioButton2.Checked Then Shell("shutdown -r -f -t " & TextBox1.Text & " -c " & TextBox2.Text)
            If RadioButton1.Checked Then Shell("shutdown -s -f -t " & TextBox1.Text & " -c " & TextBox2.Text)
        End If
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question