Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[TUT] Everthing To know about My.Computer(audio,Clipbored,FileSystem)PART 1[TUT]

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:
Code
My.Computer.Audio.Play(Location As String)
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]
Code
Then My.Computer.Audio.Stop()
Well this ones pretty self-explanitory, this will stop the sound form playing.
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
Code
My.Computer.Clipboard.Clear
the name saids it all, it will clear the copied text from the clipboard.
Contains Audio
Code
My.computer.ContainsAudio
This will tell the computer(As a Boolean) if the clip bored contains any audio data, for example
Code
My.computer.Clipboard.ContainsAudio = True

ContainsData
Code
My.Computer.Clipboard.ContainsData(Format As String) As Boolean
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
Code
My.Computer.Clipboard.ContainsImage() As Boolean
This is a Boolean, it tells the clipboard if the copied selection contains an image(A true or false value)

ContainsText
Code
My.Computer.Clipboard.ConatinsText() As Boolean
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
Code
'''To get text
My.Computer.Clipboard.GetText
Code
'''To get Data
My.Computer.Clipboard.GetData(Format As String)
Code
'''To getImage    
My.Computer.Clipboard.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
Code
My.Computer.Clock.GmtTime
Well this displays the time and date on your computer, expressed as a UTC(GMT)
Time.

LocalTime
Code
My.Computer.Clock.LocalTime
This Will display the Date and Time displayed on your computer.

TickCount
Code
My.Computer.Clock.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
Code
My.Computer.FileSystem.CopyFile(sourcefilename As String,DestinationFileName As String
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
Code
My.Computer.FileSystem.CreateDirectory(Directory As String)
This will create a folder(Directory) you have to put the path as a String

CurrentDirectory
Code
My.Computer.FileSystem.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
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)
This Will Delete A file(File As String) File path

DirectoryExists
Code
My.Computer.FileSystem.directory exists(Directory As String) As Boolean
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
Code
My.Computer.FileSystem.FileExists(File As String) as Boolean
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
Code
My.Computer.FileSystem.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
Code
My.Computer.FileSystem.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
Code
My.Computer.FileSystem.ReadAlltext(File As String)
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.

[Image: BQ6bF1l.png]
Nice but i don't see why this is important to be as a thread on HF when everything is more detailed written on MSDN.
(Oct 1, 2011 10:46 AM)Menalix Wrote:  Nice but i don't see why this is important to be as a thread on HF when everything is more detailed written on MSDN.

I don't know, felt like making a tutorial 😝 ?
[Image: BQ6bF1l.png]
Very nice tutorial just make it a little more attractive and easy to navigate :D
MAKE REP GREAT AGAIN 2027
(Oct 1, 2011 10:57 AM)Immortal Wrote:  Very nice tutorial just make it a little more attractive and easy to navigate :D

Thanks man, might edit it later to make it more "eye pleasing" :D
[Image: BQ6bF1l.png]
You might wanna reread your next tutorial, as there are quite some spelling mistakes in you tut :) I.e "Clipbored", it should be "Clipboard"
(Oct 1, 2011 12:20 PM)hio2hio Wrote:  You might wanna reread your next tutorial, as there are quite some spelling mistakes in you tut :) I.e "Clipbored", it should be "Clipboard"

lol, by the time i was done, i didn't feel like re-reading it. but i do like the feedback thanks :)
[Image: BQ6bF1l.png]
Nice tutorial!
+1 rep, your a god man. =) Thanks
(Oct 1, 2011 12:56 PM)Cherish Life Wrote:  Nice tutorial!
+1 rep, your a god man. =) Thanks

No problem, just trying to help some people out 👍
[Image: BQ6bF1l.png]
Spoiler (Click to View)

I fixed the clipboard spelling mistake :)
(Oct 2, 2011 08:08 AM)IDontNeedAUsername Wrote:  I fixed the clipboard spelling mistake :)

Thanks for the spelling fix(updated the thread with it) appreciate it 🤝
[Image: BQ6bF1l.png]
Please put the code in [code] tags, it's unreadable..
[Image: DIZMPqM.png]
(Oct 2, 2011 12:01 PM)FileX Wrote:  Please put the code in [code] tags, it's unreadable..

crap, you know what happened.... July rewrote it for me(because there was some spelling errors.. :( must of messed the [code] thing up :[

Edit: I fixed it now :P
[Image: BQ6bF1l.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by TostigMay 31, 2019 10:31 AM 4 380 May 31, 2019 10:31 AM
Last Post: Alpha_Coder
[C#] by DaaksinAug 19, 2015 03:45 AM 41 6,307 Aug 19, 2015 03:45 AM
Last Post: hexrex111
[C#] by Mr LiamJun 20, 2014 06:44 AM 2 239 Jun 20, 2014 06:44 AM
Last Post: Mr Liam