Oct 1, 2011 10:13 AM
(This post was last modified: Oct 2, 2011 12:57 PM by Rolex™.)
Ok so this is my first real tutorial, so go light on the comments ;). So i know alot of people here program in vb.net, and as a vb.net programmer i use my.computer alot. It provides information on your computer,writes/reads files and much more(we'll talk about). What the tutorial consists of:
-My.Computer.Audio
-My.Computer.Clipboard
-My.Computer.Clock
-My.Computer.Filesystem
The My.Computer.Audio is used to play a sound file(.wav), or a system sound. It also has a stop function.
Examples:
This will play the sound file from whatever the file string(path) is.
My.computer.Audio.PlaySystemSound
[Code:]
My.Computer.Audio.PlaySystemSound(systemSound As System.Media.SystemSound)
This will play a system sound from your computer
[/code]
My.Computer.Clipboard
The My.Computer.Clipboard is a pretty useful thing to know how to use. Anything you copy then paste, gets copied to the clipboard. You can put this on a button or menustrip option or anything else pretty much.
Examples:
Clear
Contains AudioThis will tell the computer(As a Boolean) if the clip bored contains any audio data, for example
ContainsData
This is a code that is a Boolean which means it tells the clipboard if the copied selection contains some kind of data from a custom format.
ContainsImage
This is a Boolean, it tells the clipboard if the copied selection contains an image(A true or false value)
ContainsText
Well this is about the same as the other "Contains", this will see if there is text copied to the clipboard(As a true/false value)
GetText,GetData,GetImage
-Ok So lets start with GetText,This will get the text from the clipboard and display it(text box,Label...ect)
-Next is GetData, this will get data form a certain file format(put into a String).
-Now GetImage, this will get the image copied to the
P.S-- I didnt want to write and explain all the Set's, ill just explain it quick. The My.Computer.Clipboard.Set(text,Image,data) is just the opposite of the Get. Instead of getting something(Pasting it) You Set it(Copy it). All thats happening is that your putting the text or image or Data as a String.
My.Computer.Clock
Well, In some programs people want a clock on there programs, well you could use this.You will need to put this to something like(text box,Label..ect) Examples:
GmtTime
Well this displays the time and date on your computer, expressed as a UTC(GMT)
Time.
LocalTime
This Will display the Date and Time displayed on your computer.
TickCount
This gets the millisecond count form the computers system timer.
FileSystem
The Filesyetm, is a great thing to know how to use. This can do things like:
-Create files
-Read text
-write text to files
-Read File Paths
-And ALOT more
CopyFile
This is used to copy one file to a different location, First you need to put the file you want to copy then you need to put the File name and then new file name.
CreateDirectory
This will create a folder(Directory) you have to put the path as a String
CurrentDirectory
This gets or gets a directory which means, you can either get the path of a directory or you can set one with a "=" sign(CurrentDirectory = path As String)
DeleteDirectory
This Will Delete A file(File As String) File path
DirectoryExists
This will check if the directory exists, you need to to put a directory path and then a Boolean. It will return the value of true/false.
FileExists
This will check if the file exists, you need to put the file path and then a Boolean, it will return a value true/false.
RenameFile
This will rename the file, you have to put the file name(as a String) then a new file name(as a String)
Writealltext
this will write all text in a(text box..ect), you have to put(File As String,text As String,append As Boolean). You can use this to write things to to a textfile.
Readalltext
This can be useful to read a textfile, all you have to do is out the file path, you can can use it like... if My.Computer.FileSystem.ReadAlltext = "yes" then ...blaha
This is just part 1, i have a part 2 comming up, it took me awhile to write this so please no flamming. Feedback is welcome though :D. Hope i helped/taught some people some things.
-My.Computer.Audio
-My.Computer.Clipboard
-My.Computer.Clock
-My.Computer.Filesystem
The My.Computer.Audio is used to play a sound file(.wav), or a system sound. It also has a stop function.
Examples:
Code
My.Computer.Audio.Play(Location As String)My.computer.Audio.PlaySystemSound
[Code:]
My.Computer.Audio.PlaySystemSound(systemSound As System.Media.SystemSound)
This will play a system sound from your computer
[/code]
Code
Then My.Computer.Audio.Stop()
Well this ones pretty self-explanitory, this will stop the sound form playing.The My.Computer.Clipboard is a pretty useful thing to know how to use. Anything you copy then paste, gets copied to the clipboard. You can put this on a button or menustrip option or anything else pretty much.
Examples:
Clear
Code
My.Computer.Clipboard.Clear
the name saids it all, it will clear the copied text from the clipboard.Code
My.computer.ContainsAudioCode
My.computer.Clipboard.ContainsAudio = TrueContainsData
Code
My.Computer.Clipboard.ContainsData(Format As String) As BooleanContainsImage
Code
My.Computer.Clipboard.ContainsImage() As BooleanContainsText
Code
My.Computer.Clipboard.ConatinsText() As BooleanGetText,GetData,GetImage
Code
'''To get text
My.Computer.Clipboard.GetTextCode
'''To get Data
My.Computer.Clipboard.GetData(Format As String)Code
'''To getImage
My.Computer.Clipboard.GetImage-Next is GetData, this will get data form a certain file format(put into a String).
-Now GetImage, this will get the image copied to the
P.S-- I didnt want to write and explain all the Set's, ill just explain it quick. The My.Computer.Clipboard.Set(text,Image,data) is just the opposite of the Get. Instead of getting something(Pasting it) You Set it(Copy it). All thats happening is that your putting the text or image or Data as a String.
My.Computer.Clock
Well, In some programs people want a clock on there programs, well you could use this.You will need to put this to something like(text box,Label..ect) Examples:
GmtTime
Code
My.Computer.Clock.GmtTimeTime.
LocalTime
Code
My.Computer.Clock.LocalTimeTickCount
Code
My.Computer.Clock.TickCountFileSystem
The Filesyetm, is a great thing to know how to use. This can do things like:
-Create files
-Read text
-write text to files
-Read File Paths
-And ALOT more
CopyFile
Code
My.Computer.FileSystem.CopyFile(sourcefilename As String,DestinationFileName As StringCreateDirectory
Code
My.Computer.FileSystem.CreateDirectory(Directory As String)CurrentDirectory
Code
My.Computer.FileSystem.CurrentDirectoryDeleteDirectory
Code
My.Computer.FileSystem.DeleteDirectory(directory As String,onDirectory As Microsoft.visual basics.FileIO.DeleteDirectoryOption
[code]
ok, so if you want to delete a directory you have to first put a directory as string(File Path) and then the option to Deleteallcontents or Delete it if its empty.
DeleteFile
[Code]
My.Computer.FileSystem.DeleteFile(File As String)DirectoryExists
Code
My.Computer.FileSystem.directory exists(Directory As String) As BooleanFileExists
Code
My.Computer.FileSystem.FileExists(File As String) as BooleanRenameFile
Code
My.Computer.FileSystem.RenameFileWritealltext
Code
My.Computer.FileSystem.WritealltextReadalltext
Code
My.Computer.FileSystem.ReadAlltext(File As String)This is just part 1, i have a part 2 comming up, it took me awhile to write this so please no flamming. Feedback is welcome though :D. Hope i helped/taught some people some things.


![[Image: BQ6bF1l.png]](https://i.imgur.com/BQ6bF1l.png)
![[Image: gh_banner.png]](https://hexui.com/asset/img/gh_banner.png)


![[Image: DIZMPqM.png]](https://i.imgur.com/DIZMPqM.png)