{"id":3256,"date":"2013-06-14T11:49:01","date_gmt":"2013-06-14T03:49:01","guid":{"rendered":"http:\/\/www.vbtutor.net\/?page_id=3256"},"modified":"2017-10-16T16:33:28","modified_gmt":"2017-10-16T08:33:28","slug":"visual-basic-2010-graphical-dice","status":"publish","type":"page","link":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/","title":{"rendered":"Visual Basic 2010 Graphical Dice"},"content":{"rendered":"<p>Dice is an important tool used in many board games, virtual or physical. We have shown you how to create graphical dice using Visual Basic 6, you can check out the link below to view the code in VB6.<\/p>\n<p><a title=\"Graphical Dice in VB6\" href=\"http:\/\/www.vbtutor.net\/VB_Sample\/dice3.htm\">http:\/\/www.vbtutor.net\/VB_Sample\/dice3.htm<\/a><\/p>\n<p>Writing the code to create a graphical dice in Visual Basic 2010 is slightly different from the code in VB6. In VB6, we used the shape control to draw the dots. However, in Visual Basic 2010, there is no built-in shape tool so we use images instead. Therefore, the first step in creating a graphical dice in Visual Basic 2010 is to create six images, each denote one of the faces of the dice. Next, you write a code that load the images randomly, it is that simple.<\/p>\n<p style=\"text-align: center;\"><strong>The Interface<\/strong><\/p>\n<p><a href=\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3258\" alt=\"Visual Basic 2010 dice\" src=\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg\" width=\"338\" height=\"300\" \/><\/a><br \/>\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<ins class=\"adsbygoogle\"\n     style=\"display:block; text-align:center;\"\n     data-ad-layout=\"in-article\"\n     data-ad-format=\"fluid\"\n     data-ad-client=\"ca-pub-3033628290023372\"\n     data-ad-slot=\"1723562988\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<p><strong>The Code<\/strong><\/p>\n<p>Public Class Form1<br \/>\nDim m, n As Integer<br \/>\nPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br \/>\nEnd Sub<\/p>\n<p>Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br \/>\nm = m + 10<br \/>\nIf m &lt; 1000 Then<\/p>\n<p>n = Int(1 + Rnd() * 6)<br \/>\nSelect Case n<br \/>\nCase 1<br \/>\nPictureBox1.Image = Image.FromFile(&#8220;C:\\Documents and Settings\\Voon Kiong Liew\\My Documents\\Liew Folder\\VB_Sample\\Images\\dice1.jpg&#8221;)<br \/>\nCase 2<br \/>\nPictureBox1.Image = Image.FromFile(&#8220;C:\\Documents and Settings\\Voon Kiong Liew\\My Documents\\Liew Folder\\VB_Sample\\Images\\dice2.jpg&#8221;)<br \/>\nCase 3<br \/>\nPictureBox1.Image = Image.FromFile(&#8220;C:\\Documents and Settings\\Voon Kiong Liew\\My Documents\\Liew Folder\\VB_Sample\\Images\\dice3.jpg&#8221;)<br \/>\nCase 4<br \/>\nPictureBox1.Image = Image.FromFile(&#8220;C:\\Documents and Settings\\Voon Kiong Liew\\My Documents\\Liew Folder\\VB_Sample\\Images\\dice4.jpg&#8221;)<br \/>\nCase 5<br \/>\nPictureBox1.Image = Image.FromFile(&#8220;C:\\Documents and Settings\\Voon Kiong Liew\\My Documents\\Liew Folder\\VB_Sample\\Images\\dice5.jpg&#8221;)<br \/>\nCase 6<br \/>\nPictureBox1.Image = Image.FromFile(&#8220;C:\\Documents and Settings\\Voon Kiong Liew\\My Documents\\Liew Folder\\VB_Sample\\Images\\dice6.jpg&#8221;)<br \/>\nEnd Select<br \/>\nElse<br \/>\nTimer1.Enabled = False<br \/>\nm = 0<\/p>\n<p>End If<br \/>\nEnd Sub<\/p>\n<p>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br \/>\nTimer1.Enabled = True<\/p>\n<p>End Sub<br \/>\nEnd Class<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dice is an important tool used in many board games, virtual or physical. We have shown you how to create graphical dice using Visual Basic 6, you can check out the link below to view the code in VB6. http:\/\/www.vbtutor.net\/VB_Sample\/dice3.htm Writing the code to create a graphical dice in Visual Basic 2010 is slightly different &hellip; <a href=\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Visual Basic 2010 Graphical Dice<\/span><\/a><\/p>\n","protected":false},"author":23013,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-3256","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Visual Basic 2010 Graphical Dice - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB<\/title>\n<meta name=\"description\" content=\"This article describes how to create a graphical dice in visual basic 2010.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Visual Basic 2010 Graphical Dice - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\" \/>\n<meta property=\"og:description\" content=\"This article describes how to create a graphical dice in visual basic 2010.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Vbtutor\" \/>\n<meta property=\"article:modified_time\" content=\"2017-10-16T08:33:28+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@liewvk\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/\",\"url\":\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/\",\"name\":\"Visual Basic 2010 Graphical Dice - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\",\"isPartOf\":{\"@id\":\"https:\/\/www.vbtutor.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg\",\"datePublished\":\"2013-06-14T03:49:01+00:00\",\"dateModified\":\"2017-10-16T08:33:28+00:00\",\"description\":\"This article describes how to create a graphical dice in visual basic 2010.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#primaryimage\",\"url\":\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg\",\"contentUrl\":\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg\",\"width\":338,\"height\":300,\"caption\":\"Visual Basic 2010 dice\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vbtutor.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Visual Basic 2010 Graphical Dice\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vbtutor.net\/#website\",\"url\":\"https:\/\/www.vbtutor.net\/\",\"name\":\"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\",\"description\":\"Start learning Visual Basic from beginner to advanced. Includes VB.NET, VBA, and classic VB tutorials for students and professionals.\",\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Visual Basic 2010 Graphical Dice - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","description":"This article describes how to create a graphical dice in visual basic 2010.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/","og_locale":"en_US","og_type":"article","og_title":"Visual Basic 2010 Graphical Dice - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","og_description":"This article describes how to create a graphical dice in visual basic 2010.","og_url":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/","og_site_name":"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","article_publisher":"https:\/\/www.facebook.com\/Vbtutor","article_modified_time":"2017-10-16T08:33:28+00:00","og_image":[{"url":"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@liewvk","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/","url":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/","name":"Visual Basic 2010 Graphical Dice - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","isPartOf":{"@id":"https:\/\/www.vbtutor.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#primaryimage"},"image":{"@id":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#primaryimage"},"thumbnailUrl":"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg","datePublished":"2013-06-14T03:49:01+00:00","dateModified":"2017-10-16T08:33:28+00:00","description":"This article describes how to create a graphical dice in visual basic 2010.","breadcrumb":{"@id":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#primaryimage","url":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg","contentUrl":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/06\/dice.jpg","width":338,"height":300,"caption":"Visual Basic 2010 dice"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2010-graphical-dice\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vbtutor.net\/"},{"@type":"ListItem","position":2,"name":"Visual Basic 2010 Graphical Dice"}]},{"@type":"WebSite","@id":"https:\/\/www.vbtutor.net\/#website","url":"https:\/\/www.vbtutor.net\/","name":"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","description":"Start learning Visual Basic from beginner to advanced. Includes VB.NET, VBA, and classic VB tutorials for students and professionals.","inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/3256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/users\/23013"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/comments?post=3256"}],"version-history":[{"count":9,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/3256\/revisions"}],"predecessor-version":[{"id":11919,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/3256\/revisions\/11919"}],"wp:attachment":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/media?parent=3256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/categories?post=3256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/tags?post=3256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}