Tuesday, November 16, 2010

How can I shut down my PC using a VB Script?

Hi all,



I would like a VB script which, when opened, shuts down the PC. I will admit that I know nothing about VB and do not have the time to learn. I need this for an outside application... I don't think it should be difficult for an experienced programmer. Thanks!How can I shut down my PC using a VB Script?
The above answer is a good answer for doing it in VB Script (right out of XP).



But, if the script is going to be invoked from a command script, on XP, like a .bat or .cmd, check out the ';shutdown'; command line command.How can I shut down my PC using a VB Script?
hey you dont need that at all,just do the normal way
strComputer = ';.';

Set objWMIService = GetObject(';winmgmts:'; _

%26amp; ';{impersonationLevel=impersonate}!\\'; _

%26amp; strComputer %26amp; ';\root\cimv2';)

Set colOperatingSystems = objWMIService.ExecQuery _

(';Select * from Win32_OperatingSystem';)

For Each objOperatingSystem in colOperatingSystems

objOperatingSystem.Shutdown

Next

Can you open a program with VB script?

I'd like to make a thing that opens a message box, then a program. I can't figure out how to open a program with VB script, though. Is there a way? If so, what is it?Can you open a program with VB script?
Robert, You can do anything with anything. click on link below...

How to make a calculator project in Excel using vb?

Just +, - ,* ,%26amp; / these operations enough ,i am a beginner give full detailsHow to make a calculator project in Excel using vb?
1. 1st open a new workbook, Alt+F11 go to vba editor, on the left side, right click on a icon and choose insert userform, when click on this userform toolbox of controls appear, click the textbox button and click and drag a rectangle on the userform to create an entry box, create another textbox just underneath the 1st one.

2. click on the commandbutton on the toolbox, click and drag a rectangle to create a button on the userform, make another four for each of the calculation sign,

3. click on the label button on the toolbox, click and drag a rectangle to create a button on the userform, that would be for the displaying the result

4. click on each of the button, go to the properties window on button left(F4 to open if not already there), change the value right of caption to +, -, x, / respectively for 4 buttons

5. click on the label, go to properties and delete the value in right of caption, change the background color of this label(if like) by clicking on box right of Backcolor, palette,

6. right click on each of the calculation sign button,

for + put the following into the ';Private sub CommandButton Click()'; and ';End Sub';

Label1.Caption = TextBox1.Value * 1 + TextBox2.Value * 1

for - put the following into the ';Private sub CommandButton Click()'; and ';End Sub';

Label1.Caption = TextBox1.Value - TextBox2.Value

for x put the following into the ';Private sub CommandButton Click()'; and ';End Sub';

Label1.Caption = TextBox1.Value * TextBox2.Value

for / put the following into the ';Private sub CommandButton Click()'; and ';End Sub';

Label1.Caption = TextBox1.Value / TextBox2.Value

7. if you want to add feature to it like only calculate when both textbox have number add following line to each of the 4 sub

If TextBox1.Value = ';'; Or TextBox2.Value = ';'; Then Exit Sub

Here's a demo illustrate the above http://www.freewebs.com/swhtam/YA/myCalc鈥?/a> Alt+F11 and right click on the userform1, view code to see all the code listed above, view object to see the set up of userform1.

Please contact for more details

How do I split a string array and display the result in a text box using vb .net?

I'm working on an assignment. after joining two strings, I must now use the Split to split the string back to two strings and display the result in a text box.How do I split a string array and display the result in a text box using vb .net?
Well, you said you need to use split to do this. Split takes a string to split, a delimiter to split and (optionally) an integer to limit the amount of times the string will be split and returns an array.

consider this code





Dim myFirstString As String

Dim mySecondString As String

Dim combinedString As String

Dim splitstring As String() ' note that this is an ARRAY of strings





myFirstString = ';hello';

mySecondString = ';world';

combinedString = myFirstString %26amp; '; '; %26amp; mySecondString

'combinedString now holds ';hello world';

' now split the string every time there is a space

splitstring = Split(combinedString, '; ';)

MessageBox.Show(splitstring(0))

MessageBox.Show(splitstring(1))

'alternatively you can use a for each statement to loop through the array

For Each part As String In Split(combinedString, '; ';)

MessageBox.Show(part)

NextHow do I split a string array and display the result in a text box using vb .net?
New_string=Mid$(String,Start,Number_of_c鈥?br>


example:



strc=';Hello World';



new_str1=Mid$(strc,1,5) 'new_str1= ';Hello';



new_str2=Mid$(strc,6) 'new_str= ';World';
  • find an interesting online
  • How do I retrieve data from websites using a VB program?

    I am fairly new to the concept of programming. I have been studying Computing at AS and A level for just over a year now.. and am stuck.



    For my project I want to implement the distance between two given locations. The user will enter a postcode, and then the program should retrieve the distance from here to where his next appointment is, using Google Maps.



    I have no idea whether this is possible or not.



    Thanks for any help..How do I retrieve data from websites using a VB program?
    Not exactly sure, what you are looking to accomplish.



    Are you trying to harvest the longitude and latitude from google maps?



    Are you tring to scrape text from the web site?



    We do this all the time, using VB.net.



    Basically you need to call the website, and harvest the page as a string.



    You can then read the string and find any ';text'; that is between two tags or strings.



    For example: If this is your text on the site:



    The distance is 47 miles



    Then you can easily harvest ';47'; by writing code that will grab whatever is between ';is '; and '; miles';



    I can maybe help you further, if you drop me a line (you can go here http://dreamxl.com/clients) and submit a ticket to me.

    How do I convert to ASCII values in VB?

    Basically, if I give my program a number (ex. 32), it will convert it to whatever character has that ascii value (in this case '@')

    33 = !

    38 = %26amp;

    48 = 0

    97 = a

    and so on.



    Thanks!How do I convert to ASCII values in VB?
    You can use this functions:



    The 'Asc' function will convert your character to its ASCII,

    聽 Asc(your character in string form)



    The 'Chr' function will convert your ASCII number to its character,

    聽Chr(your ascii number in integer form)



    And also you can use 'AscW' , 'ChrW' and 'AscB' , 'ChrB' instead of 'Asc' , 'Chr' for Unicode and Binary code.

    How to create a table with some empty rows in vb.net(in code behind) dynamically at runtime?

    How to create a table with some empty rows in vb.net(in code behind) dynamically at runtime so that we can directly insert data into the database through the table without using update statement. And i also want to add a row dynamically to the table with a button clickHow to create a table with some empty rows in vb.net(in code behind) dynamically at runtime?
    good luck with that first part