You are viewing our Forum Archives. To view or take place in current topics click here.
Basic of Visual Basics Coding Tutorial
Posted:

Basic of Visual Basics Coding TutorialPosted:

Mathazad
  • Ladder Climber
Status: Offline
Joined: Oct 23, 201013Year Member
Posts: 320
Reputation Power: 12
Status: Offline
Joined: Oct 23, 201013Year Member
Posts: 320
Reputation Power: 12
Hello my name is Mathazad i will be showing you th very basics of VB.net
This will just be featuring coding and interface.
~CrEdItS~

Mathazad
Lots of youtube videos.

Your first basic code
So when you start up visual basics for the first time you will probably want to start with just the regular windows basics form
when you start up your project you will see a small white box, with nothing on it.
Now at this stage your program will do absolutely nothing.
Now for your first piece of coding drag a button from the toolbox.
when you place your button down click on it once,to the right you will see an information box just above it will say button1
then double click button1 then type the following:
If Button1.Enabled = true then MsgBox("Hello im a button")
the words in parentheses and quotation marks is what you want to pop up when you press/enable the button.



Your first project
Start a new form, then drag and drop from the toolbox WebBrowser
then add a button and a textbox and double click the button and type:
If Button1.Enabbled=true then WebBrowser1.Navigate(Textbox1.text)
what this does: When you click the first button the URL you typed in the textbox will be navigated too.Then for the button click on it so its only selected change the text to :Navigate you do this by changing it in the properties box to the right.
then add 4 new boxes
[quote]For each button type one of the following and rename them to there respective action eg.Forwards
so:
If Button1.Enabled=true then WebBrowser.goforward
If Button1.Enabled=true then WebBrowser.goback
If Button1.Enabled=true then WebBrowser.refresh
If Button1.Enabled=true then WebBrowser.gohome[/quote]you now have a basic webbrowser then in the properties of the webbrowser change the url/homepage to eg.: google.com/facebook.com


Analysing Code
To start we must understand that visual basics is a coding langauge in it's own rights and was create by Microsoft
The term visual obviously refers the GUI/UI side of your program where as basic refers to the easy to use code, this easy coding was a stand out from other languages because certain things that were done in several lines of code on other languages could be done in under a sentence e.g. MsgBox("Hello").
Now Parts of coding Snippets.[spoil]im sorry i cannot explain this just yet as my visual basics programs are not working.Will be done with in a few hours.
[/spoil]


How to create a flash game trainer
http://www.youtube.com/watch?v=erh9GOJQwg4 too long to type...

more youtube tuts:


more will be added later.

Some Snippets:
Originally Posted on Stage3000.net by me
Compilation of some of my simple visual basic snippets!
~Credits~
NextGen1
Me
MPGH Snippet List

[SIZE=4]WEB BROWSER SNIPPETS[/SIZE]
Search Function For Visual Basics(google)
WebBrowser1.Navigate("http://www.google.com/search?hl=en&q=" & TextBox2.Text & "&btnG=Google+Search")
'change "WebBrowser" to the name of your own browser.
Form1.Caption = "WebBrowser - Search Results"

YOUTUBE!
WebBrowser1.navigate("http://www.youtube.com/results?search_query=" & TextBox1.Text & "&aq=f")


This makes LinkLabels navigate to said web address.
If LinkLabel1.Enabled = True Then WebBrowser1.Navigate("Channge to address.")


Makes textbox rename to navigated webpage
Private Sub Navigate(ByVal address As String)

If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If

Try
webBrowser1.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try

End Sub
Private Sub webBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated

TextBox1.Text = WebBrowser1.Url.ToString()

End Sub

OR
Private Sub Navigate(ByVal address As String)

webBrowser1.Navigate(address)

End Sub

Private Sub webBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated

TextBox1.Text = WebBrowser1.Url.absoluteuri

End Sub





[SIZE=4]Other Snippets[/SIZE]

Custom Opacity(See through or not)
Me.Opacity = 0.9


Get Computers Time(needs label)
Label1.text = My.Computer.Clock.LocalTime


Control Panel
Shell("rundll32.exe shell32.dll Control_RunDLL")


Turn PC Off
Shell ("Rundll32.exe user32.dll,LockWorkStation")


Log PC Off
Shell ("rundll32.exe shell32.exe,SHExitWindowsEx 0")


Display Wether or not you have a 32 or 64 bit processor
Dim x As String = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
If x = "x86" Then
MsgBox("Processor is 32 Bit")
Else
MsgBox("Processor is 64 Bit")
End If




[SIZE=4]Exetreme Basics For teh Nubs[/SIZE]
Make it so when Button1(Changeable)is clicked you will get a message saying what ever you put in parentheses.
If Button1.Enabled=True Then MsgBox("W/E you want to say")


Gets PC Information
Public Function GetSystemInfo() As String
Dim win As String = My.Computer.Info.OSFullName
Dim virMem As String = My.Computer.Info.TotalVirtualMemory
Dim winVer As String = My.Computer.Info.OSVersion
Return MsgBox("Your Current OS is: " & win _
& vbNewLine _
& "Your OS Version is: " & winVer _
& vbNewLine _
& "Your Total Virtual Memory is: " & virMem)
End Function


Make PC Beep (Needs to be added to buttons code)
Console.Beep()

or
Microsoft.VisualBasic.Interaction.Beep()


Process List
1. add a listbox to your form
2. double click on the form and insert this code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim p As Process
For Each p In System.Diagnostics.Process.GetProcesses
ListBox1.Items.Add(p.ProcessName)
Next
End Sub


More coming sorry...


Last edited by Mathazad ; edited 2 times in total
#2. Posted:
lee74saurusr3x
  • Ladder Climber
Status: Offline
Joined: Feb 18, 201014Year Member
Posts: 333
Reputation Power: 12
Status: Offline
Joined: Feb 18, 201014Year Member
Posts: 333
Reputation Power: 12
This isn't a tutorial, it's just snippets of code you mixed with like 2 word explanations of what they do. I really don't feel like going on and on and looking like a flamer, so I won't.
#3. Posted:
Mathazad
  • Ladder Climber
Status: Offline
Joined: Oct 23, 201013Year Member
Posts: 320
Reputation Power: 12
Status: Offline
Joined: Oct 23, 201013Year Member
Posts: 320
Reputation Power: 12
lee74saurusr3x wrote This isn't a tutorial, it's just snippets of code you mixed with like 2 word explanations of what they do. I really don't feel like going on and on and looking like a flamer, so I won't.
but you still do look like a flamer, i never said at one stag that this is it the whole thread is finished i just need time to think of what to add next.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.