<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3877311070021047953</id><updated>2012-02-16T16:41:31.116-08:00</updated><title type='text'>match function vb2008</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://matchfunction3vb2008.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3877311070021047953/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://matchfunction3vb2008.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>vbnetcode</name><uri>http://www.blogger.com/profile/04926504053784281645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3877311070021047953.post-8078496379416602068</id><published>2009-02-04T02:21:00.001-08:00</published><updated>2009-02-04T02:21:51.995-08:00</updated><title type='text'></title><content type='html'>Visual Basic 2008 Tutorial&lt;br /&gt;Lesson 14: Functions Part III- Math Functions&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We have learned how to Vb2008 can perform arithmetic functions using standard mathematical operators. However, for more complex mathematical calculations, we need to use the built-in math functions in VB2008. There are numerous built-in mathematical functions in Visual Basic which we will introduce them one by one.&lt;br /&gt;&lt;br /&gt;14.1 The Abs function&lt;br /&gt;&lt;br /&gt;The Abs return the absolute value of a given number. &lt;br /&gt;&lt;br /&gt;The syntax is&lt;br /&gt;&lt;br /&gt;       Math. Abs (number)&lt;br /&gt;&lt;br /&gt;* The Math keyword here indicates that the Abs function belong to the Math class. However, not all mathematical functions belong to the Math class.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;14.2 The Exp function&lt;br /&gt;&lt;br /&gt;The Exp of a number x is the exponential value of x, i.e.  ex . For example, Exp(1)=e=2.71828182 &lt;br /&gt;&lt;br /&gt;The syntax is Math.Exp (number)&lt;br /&gt;&lt;br /&gt;Example: &lt;br /&gt;&lt;br /&gt;Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;&lt;br /&gt;Dim num1, num2 As Single&lt;br /&gt;num1 = TextBox1.Text&lt;br /&gt;num2 = Math.Exp(num1)&lt;br /&gt;Label1.Text = num2&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;¡¡ &lt;br /&gt;&lt;br /&gt;14.3 The Fix Function&lt;br /&gt;&lt;br /&gt;The Fix function truncate the decimal part of a positive number and returns the largest integer smaller than the number. However, when the number is negative, it will return smallest  integer larger than the number. For example, Fix(9.2)=9  but Fix(-9.4)=-9&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;&lt;br /&gt;Dim num1, num2 As Single&lt;br /&gt;num1 = TextBox1.Text&lt;br /&gt;num2 = Fix(num1)&lt;br /&gt;Label1.Text = num2&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;14.4 The Int Function&lt;br /&gt;&lt;br /&gt;The Int is a function that converts a number into an integer by truncating its decimal part and the resulting integer is the largest integer that is smaller than he number. For example&lt;br /&gt;&lt;br /&gt;Int(2.4)=2, Int(6.9)=6 , Int(-5.7)=-6, Int(-99.8)=-100&lt;br /&gt;&lt;br /&gt;14.5 The Log Function&lt;br /&gt;&lt;br /&gt;The Log function is the function that returns the natural logarithm of a number. For example, Log(10)=2.302585&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;&lt;br /&gt;Dim num1, num2 As Single&lt;br /&gt;num1 = TextBox1.Text&lt;br /&gt;num2 = Math.Log(num1)&lt;br /&gt;Label1.Text = num2&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;* The logarithm of num1 will be displayed on label1&lt;br /&gt;&lt;br /&gt;14.6 The Rnd( ) Function&lt;br /&gt;&lt;br /&gt;The Rnd is very useful when we deal with the concept of chance and probability. The Rnd function returns a random value between 0 and 1. Random numbers in their original form are not very useful in programming until we convert them to integers. For example, if we need to obtain a random output of 6 integers ranging from 1 to 6, which makes the program behave like a virtual dice, we need to convert the random numbers to integers using the formula Int(Rnd*6)+1.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;Dim num as integer&lt;br /&gt;&lt;br /&gt;Randomize( )&lt;br /&gt;&lt;br /&gt;Num=Int(Rnd()*6)+1&lt;br /&gt;&lt;br /&gt;Label1.Text=Num&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;¡¡&lt;br /&gt;&lt;br /&gt; In this example, Int(Rnd*6) will generate a random integer between 0 and 5 because the function Int truncates the decimal part of the random number and returns an integer. After adding 1, you will get a random number between 1 and 6 every time you click the command button. For example, let say the random number generated is 0.98, after multiplying it by 6, it becomes 5.88, and using the integer function Int(5.88) will convert the number to 5; and after adding 1 you will get 6. &lt;br /&gt;&lt;br /&gt;14.7 The Round Function&lt;br /&gt;&lt;br /&gt;The Round  function is the function that rounds up a number to a certain number of decimal places. The Format is Round (n, m) which means to round a number n to m decimal places. For example, Math.Round (7.2567, 2) =7.26&lt;br /&gt;&lt;br /&gt;Example&lt;br /&gt;&lt;br /&gt; Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;Dim num1, num2 As Single&lt;br /&gt;num1 = TextBox1.Text&lt;br /&gt;num2 = Math.Round(num1, 2)&lt;br /&gt;Label1.Text = num2&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;* The Math keyword here indicates that the Round function belong to the Math class. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;source : http://www.vbtutor.net/vb2008/vb2008tutor.html&lt;br /&gt;-----------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;a href="http://kwlan-riaq.blogspot.com"&gt;KWLAN&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://membacabukuonline.blogspot.com"&gt;Trik Membaca Buku Online&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://membongkar-proteksifolder.blogspot.com"&gt;Trik Membongkar-proteksi folder&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://membuatgambaracsii.blogspot.com"&gt;Trik Membuat gambar Acsii&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://membuaticon.blogspot.com"&gt;Trik Membuat icon&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://memproteksifolder.blogspot.com"&gt;Trik Memproteksi Folder&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://mencarifile.blogspot.com"&gt;Trik Mencari File&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://mengembalikandata.blogspot.com"&gt;Trik Mengembalikan data&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://mengiringsearchengine.blogspot.com"&gt;Trik Mengiring ke search engine&lt;/a&gt;&lt;br/&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=woodworkin09c-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=B001F7AHXM&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt; &lt;iframe src="http://rcm.amazon.com/e/cm?t=woodworkin09c-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=B000QJPMMQ&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3877311070021047953-8078496379416602068?l=matchfunction3vb2008.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://matchfunction3vb2008.blogspot.com/feeds/8078496379416602068/comments/default' title='Poskan Komentar'/><link rel='replies' type='text/html' href='http://matchfunction3vb2008.blogspot.com/2009/02/visual-basic-2008-tutorial-lesson-14.html#comment-form' title='0 Komentar'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3877311070021047953/posts/default/8078496379416602068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3877311070021047953/posts/default/8078496379416602068'/><link rel='alternate' type='text/html' href='http://matchfunction3vb2008.blogspot.com/2009/02/visual-basic-2008-tutorial-lesson-14.html' title=''/><author><name>vbnetcode</name><uri>http://www.blogger.com/profile/04926504053784281645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
