<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>microsoft office tips</title>
	<atom:link href="http://xtremetips.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://xtremetips.com</link>
	<description>Tips and tricks for Microsoft Office and other cool stuff</description>
	<lastBuildDate>Mon, 07 May 2012 21:36:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>VB: Rock Paper Scissors &#8211; Part 2</title>
		<link>http://xtremetips.com/vb-rock-paper-scissors-part-2/</link>
		<comments>http://xtremetips.com/vb-rock-paper-scissors-part-2/#comments</comments>
		<pubDate>Mon, 07 May 2012 21:29:09 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[make a game]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[part 2]]></category>
		<category><![CDATA[rock]]></category>
		<category><![CDATA[rock paper scissors]]></category>
		<category><![CDATA[scissors]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=285</guid>
		<description><![CDATA[Here&#8217;s how to add additional functionality to the VB Rock Paper Scissors game. In an earlier post I showed you how to use Visual Basic to create the bare bones of a Rock Paper Scissors game. Now I&#8217;ll show you how to add some additional features to it. When you start adding things to a [...]]]></description>
			<content:encoded><![CDATA[<p><em>Here&#8217;s how to add additional functionality to the VB Rock Paper Scissors game</em>.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_opener.jpg"><img class="aligncenter size-full wp-image-289" title="VB_rock_paper_scissors_pt2_opener" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_opener.jpg" alt="how to make a game part two" width="540" height="494" /></a></p>
<p>In an earlier post I showed you how to use Visual Basic to create the bare bones of a Rock Paper Scissors game. Now I&#8217;ll show you how to add some additional features to it.</p>
<p>When you start adding things to a program take care because it is possible to end up breaking the program rather than improving it. Start by making a list of the options you want to add to the program and then add them one or two at a time. Test the program regularly as you go to make sure it is behaving as expected.</p>
<p>For my game I&#8217;ll add options that allow you to play one round, three, five or an unlimited number of rounds. If the user opts to play an unlimited number of rounds they will be offered a checkbox to click when they&#8217;re ready to finish. The options will be offered using four radio buttons positioned inside a groupbox. The checkbox can be placed anywhere on the screen. I’ll also add a scoring system to report the final game score. This will require some additional variables to manage the number of rounds to be played, the number already played and variables for computer and player scores.</p>
<p>Once the player has made their choice from the radio buttons, these will be hidden from view. Behind the scenes, the program will maintain the player score and the number of rounds currently played.</p>
<p>Once the required number of rounds have been played or where the player opts to finish an unlimited game, the new finishGame subroutine is called. This calculates who has won and displays the scores in two new labels (label4 and label5). Once this is done, the rounds_played variable is set to -2 to indicate a new game and the button text is changed to read Play Again.</p>
<p>The new resetGame subroutine redisplays the hidden radio buttons and the groupbox, it hides the checkbox, resets the player’s score and the rounds_played counter. It also hides the labels and changes the main button text back to Play. Once the player has chosen the number of rounds to play and their starting Rock/Paper or Scissors, the process starts over again.</p>
<p><strong>New form controls</strong></p>
<p>To add these features to your project, add four radio buttons inside a groupbox. Also add a checkbox and set its visibility to false. Add two additional labels, label4 and label5 and set their text properties to nothing.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_step1.jpg"><img class="aligncenter size-full wp-image-286" title="VB_rock_paper_scissors_pt2_step1" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_step1.jpg" alt="part 2 step 2 making a game" width="558" height="554" /></a></p>
<p>This code manages all the radio buttons:</p>
<p>&nbsp;</p>
<pre>Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged,
RadioButton2.CheckedChanged, RadioButton3.CheckedChanged,
RadioButton4.CheckedChanged
If RadioButton1.Checked Then
rounds_to_play = 1
ElseIf RadioButton2.Checked Then
rounds_to_play = 0 ' this is the code for unlimited
ElseIf RadioButton3.Checked Then
rounds_to_play = 3
ElseIf RadioButton4.Checked Then
rounds_to_play = 5
End If
rounds_played = -1
End Sub</pre>
<pre></pre>
<p>These are the new finishGame and resetGame subroutines:</p>
<pre>Sub resetGame()
RadioButton1.Visible = True
RadioButton2.Visible = True
RadioButton3.Visible = True
RadioButton4.Visible = True
GroupBox1.Visible = True
CheckBox1.Visible = False
CheckBox1.Checked = False
player_score = 0
rounds_played = -1
Button1.Text = "Play"
Label3.Text = ""
Label4.Text = ""
Label5.Text = ""
End Sub</pre>
<pre></pre>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_step2.jpg"><img class="aligncenter size-full wp-image-287" title="VB_rock_paper_scissors_pt2_step2" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_step2.jpg" alt="making a game adding code" width="514" height="303" /></a></p>
<pre>Private Sub finishGame()
If rounds_played - player_score &gt; player_score Then
Label3.Text = "Computer wins. It scored: " &amp; rounds_played - player_score &amp;
" out of " &amp; rounds_played &amp; " rounds."
ElseIf rounds_played - player_score = player_score Then
Label3.Text = "Game is a draw " &amp; player_score &amp;
" rounds each."
Else
Label3.Text = "You win! You scored: " &amp; player_score &amp; " out of " &amp; rounds_played
 &amp; " rounds."
End If
rounds_played = -2 'new game trigger
Button1.Text = "Play Again"
End Sub</pre>
<pre></pre>
<p>Add these variables to the Form Declarations area:</p>
<pre>Dim rounds_played As Integer
Dim rounds_to_play As Integer
Dim player_score As Integer
Dim computer_score As Integer
Dim resultMessage As String</pre>
<pre></pre>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_step3.jpg"><img class="aligncenter size-full wp-image-288" title="VB_rock_paper_scissors_pt2_step3" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_pt2_step3.jpg" alt="making a game" width="512" height="251" /></a>Add this code to the beginning of the Button1_click event:</p>
<pre>If rounds_played = -2 Then
resetGame()
Exit Sub
End If
If rounds_played = -1 Then
RadioButton1.Visible = False
RadioButton2.Visible = False
RadioButton3.Visible = False
RadioButton4.Visible = False
GroupBox1.Visible = False
If RadioButton2.Checked Then CheckBox1.Visible = True
player_score = 0
rounds_played = 0
End If
Label4.Text = "Round #: " &amp; rounds_played + 1</pre>
<pre></pre>
<p>And add this code to the end of the Button1_click event replacing the previous Select Case gameResult code:</p>
<pre>Select Case gameResult
Case 0 ' Draw
resultMessage = "It's a draw, play again."
Case 1 ' computer wins
rounds_played = rounds_played + 1
resultMessage = "Computer won that round"
Case 2 ' player wins
player_score = player_score + 1
rounds_played = rounds_played + 1
resultMessage = "You won that round"
End Select
If (rounds_to_play &gt; 0 And rounds_played = rounds_to_play) Then
Call finishGame()
ElseIf CheckBox1.Checked = True Then
Call finishGame()
End If
Label5.Text = resultMessage</pre>
<pre></pre>
<p>Save your file and test it.</p>
<p>Click <a href="https://www.box.com/s/d0adc362eb4ca3427988" target="_blank">here</a> to download a file containing all the code for the project.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/vb-rock-paper-scissors-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Basic 2010: Rock Paper Scissors</title>
		<link>http://xtremetips.com/visual-basic-2010-rock-paper-scissors/</link>
		<comments>http://xtremetips.com/visual-basic-2010-rock-paper-scissors/#comments</comments>
		<pubDate>Mon, 07 May 2012 21:14:30 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[make a game]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[rock]]></category>
		<category><![CDATA[rock paper scissors]]></category>
		<category><![CDATA[scissors]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=276</guid>
		<description><![CDATA[Learn some simple game logic and find out how to create this simple game. When you&#8217;re learning to program in a language like Visual Basic one interesting way to extend your skills is to recreate a game as a VB program. Here I&#8217;ll discuss the game: Rock Paper Scissors. I&#8217;ll discuss the logic that you [...]]]></description>
			<content:encoded><![CDATA[<p><em>Learn some simple game logic and find out how to create this simple game.</em></p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_opener.jpg"><img class="aligncenter size-full wp-image-278" title="VB_rock_paper_scissors_opener" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_opener.jpg" alt="making a game with visual basic" width="597" height="407" /></a></p>
<p>When you&#8217;re learning to program in a language like Visual Basic one interesting way to extend your skills is to recreate a game as a VB program. Here I&#8217;ll discuss the game: Rock Paper Scissors. I&#8217;ll discuss the logic that you would use to design and code the game and then I&#8217;ll show how to build the game itself.</p>
<p>The concept of Rock Paper Scissors if it is played against the computer is that you will make a choice of one of the three options, rock, paper and scissors. When you make your choice, the computer will make its choice and then the result will be determined. If you and the computer choose the same object, neither wins. If you choose rock and the computer chooses scissors, the computer wins. Paper beats Rock and Scissors beats Paper.</p>
<p>Computers aren&#8217;t smart enough to choose to play rock, paper or scissors but they can calculate a random number (say between 0 and 2) so you can make the random number represent rock, paper or scissors – 0 for rock, 1 for paper, 2 for scissors.</p>
<p>Your game will need a combobox from which you can make your choice, you&#8217;ll need to know what the computer chose and you&#8217;ll need to know the game result.</p>
<p>I&#8217;ll use picture boxes to give the game some visual appeal and I&#8217;ll source some images from the Microsoft online clip art collection. You will need three images all the size and save saved as rock.jpg, paper.jpg, scissors.jpg and rps.jpg (a composite image used to &#8216;hide&#8217; the computer&#8217;s choice) while you make your choice.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_step1.jpg"><img class="aligncenter size-full wp-image-279" title="VB_rock_paper_scissors_step1" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_step1.jpg" alt="making a game step 1" width="411" height="491" /></a></p>
<h1>Get Started</h1>
<p>Launch Visual Basic Express 2010, start a new project and choose a Windows Form. Add two picture boxes, two buttons, three labels and a combobox. Set the collection for the combobox to Rock, Paper and Scissors and set it&#8217;s AllowDrop property to true.</p>
<p>The buttons are labeled Play and Cancel.</p>
<p>Label1 and Label2 have their text property set to You and Computer respectively.</p>
<p>Label3 has no entry in its text property – this will be set programmatically.</p>
<p>To add the images to the resource file, select the Solution Explorer and click My Project, Resources.resx. Choose Add Resource &gt; Existing Itemand import all four images.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_step2.jpg"><img class="aligncenter size-full wp-image-280" title="VB_rock_paper_scissors_step2" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_step2.jpg" alt="making a game step 2" width="283" height="242" /></a></p>
<p>Set the image property of both pictureboxes to the image rps.jpg which will be in your Project Resource file.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_step3.jpg"><img class="aligncenter size-full wp-image-281" title="VB_rock_paper_scissors_step3" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_rock_paper_scissors_step3.jpg" alt="making a game step 3" width="569" height="458" /></a></p>
<p>This is the code required to run the program:</p>
<p>&nbsp;</p>
<pre>Public Class Form1
   Dim userSelected As Integer
   ' gameResult: 0-draw, 1-computer wins, 2-user wins
   Dim gameResult As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rand As New Random()
Dim computerChoice = rand.Next(3)
If computerChoice = userSelected Then gameResult = 0
Select Case computerChoice
Case 0
' computer chooses Rock / user chooses Paper - user wins
If userSelected = 1 Then gameResult = 2
' computer chooses Rock / user chooses Scissors - computer wins
If userSelected = 2 Then gameResult = 1
PictureBox2.Image = My.Resources.rock
Case 1
' computer chooses Paper / user chooses Rock - computer wins
If userSelected = 0 Then gameResult = 1
' computer chooses Paper / user chooses Scissors - user wins
If userSelected = 2 Then gameResult = 2
PictureBox2.Image = My.Resources.paper
Case 2
' computer chooses Scissors / user chooses Rock - user wins
If userSelected = 0 Then gameResult = 2
' computer chooses Scissors / user chooses Paper - computer wins
If userSelected = 1 Then gameResult = 1
PictureBox2.Image = My.Resources.scissors
End Select
Select Case gameResult
Case 0
Label3.Text = "Game is a draw"
Case 1
Label3.Text = "Bad Luck! Computer wins"
Case 2
Label3.Text = "You win!"
End Select
End Sub

Private Sub ComboBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
PictureBox2.Image = My.Resources.rps
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
userSelected = ComboBox1.SelectedIndex
Select Case userSelected
Case 0
PictureBox1.Image = My.Resources.rock
Case 1
PictureBox1.Image = My.Resources.paper
Case 2
PictureBox1.Image = My.Resources.scissors
End Select
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.SelectedIndex = 0
End Sub
End Class</pre>
<pre></pre>
<p>The code in the ComboBox1_SelectedIndexChanged event displays an image matching the choice you made in the ComboBox and the Close button exits the program.</p>
<p>Most of the work takes place in the Button1_Click event. A random number between 0 and 2 is created which is used to determine the computer&#8217;s &#8216;choice&#8217;. Then the result is calculated. If you and the computer make the same choice, the game is a draw. Otherwise the Select Case statement checks the choices and an integer representing the result is stored in the variable GameResult.</p>
<p>The code then looks at the value in GameResult and displays corresponding text indicating who won in Label3.</p>
<p>Here is a link to the file <a href="https://www.box.com/s/d54a4995c127aafbf11d" target="_blank">code.txt</a> which contains the code above.</p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/visual-basic-2010-rock-paper-scissors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Visual Basic Radio Player</title>
		<link>http://xtremetips.com/create-a-visual-basic-radio-player/</link>
		<comments>http://xtremetips.com/create-a-visual-basic-radio-player/#comments</comments>
		<pubDate>Mon, 07 May 2012 20:46:32 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[radio player]]></category>
		<category><![CDATA[radio stations]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=264</guid>
		<description><![CDATA[Learn how to create your own custom radio player with the free download version of Visual Basic 2010. There are lots of fun applications that you can create with Microsoft Visual Basic 2010 utilizing the features that are built into Windows. Here I&#8217;ll show you how to create a radio player that plays your favourite [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-268" title="VB_Radio_player_opener" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_opener.jpg" alt="visual basic radio player" width="299" height="307" /></p>
<p><em>Learn how to create your own custom radio player with the free download version of Visual Basic 2010.</em></p>
<p>There are lots of fun applications that you can create with Microsoft Visual Basic 2010 utilizing the features that are built into Windows. Here I&#8217;ll show you how to create a radio player that plays your favourite stations.</p>
<p>This project uses the free Visual Basic Express Edition 2010 which you can download from: <a href="http://msdn.microsoft.com/en-us/vbasic/default" target="_blank">http://msdn.microsoft.com/en-us/vbasic/default</a>.</p>
<p>To begin, launch the program and create a new project by choosing File &gt; New Project. Choose Windows Form Application, type the name MyRadioPlayer and click Ok.</p>
<p>The radio player will make use of the Windows Media Player interface which comes with Windows. However, this tool is not available from the toolbox so you’ll need to add it manually. To do this, open the Toolbox panel, right click any position in the toolbox and choose Choose Items. This opens a Choose Toolbox Items dialog. The tool you need is a COM component so click the COM Components tab and scroll down to find the Windows Media Player tool. Select its checkbox and click Ok.</p>
<p style="text-align: center;"><img class="aligncenter  wp-image-269" title="VB_Radio_player_step1" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_step1.jpg" alt="visual basic radio player step 1" width="530" height="362" /></p>
<p>Now the Windows Media Player will be added to the toolbox and you can drag and drop it onto the form. When it appears, it will a small size object so resize it to fill most of the form.</p>
<p>Click an empty place on the form and from the Properties dialog, set the Form1 Text property to read My Radio Player.</p>
<p><img class="aligncenter size-full wp-image-270" title="VB_Radio_player_step2" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_step2.jpg" alt="visual basic radio player step 2" width="529" height="625" /></p>
<p>Add at least two more buttons to the form – each button will run one radio station &#8211; and you will want an extra button to click to exit the program.</p>
<p>Set the Text property of each button either to the station name or type Quit. Double click the Quit button and type this between the Sub and End Sub statements:</p>
<pre>End</pre>
<p>Double click on another button and, for example, to set it to play Triple J type this code between the Sub and End Sub statements:</p>
<pre>AxWindowsMediaPlayer1.URL = "http://abc.net.au/res/streaming/audio/windows/triple_j.asx"</pre>
<p><img class="aligncenter  wp-image-271" title="VB_Radio_player_step3" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_step3.jpg" alt="step 3 " width="540" height="240" /></p>
<p>This code will play the BBC1 radio stream:</p>
<pre>AxWindowsMediaPlayer1.URL = "http://www.bbc.co.uk/radio/listen/live/r1.asx"</pre>
<p>Once you have a couple of stations added you can test the application by selecting Start Debugging or press F5. Click a button to connect to a live stream and, once it has buffered, it will start playing in the player. Use the controls that come with the Windows Media Player object to pause or restart the streaming.</p>
<p><img class="aligncenter size-full wp-image-272" title="VB_Radio_player_step4" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_step4.jpg" alt="step 4" width="397" height="359" /></p>
<p>You can customize the Windows Media Player control by right clicking it and choose Properties. There are various properties that you can set including those that configure the controls, layout, playback options and volume for the player.</p>
<p>You can now add more buttons for all your favourite stations and, if desired, test your VB skills by adding a text box and an additional button so you can paste a station’s URL into the text box and play it by clicking the button.</p>
<h1>How to find stations to play</h1>
<p>The web is a good source of radio stations to play on your player. For example, at this website <a href="http://www.abc.net.au/radio/listenlive.htm#upgrades" target="_blank">http://www.abc.net.au/radio/listenlive.htm#upgrades</a> you will find links to the Windows Media Player audio streams for all major ABC stations.</p>
<p><img class="aligncenter size-full wp-image-265" title="VB_Radio_player_step5" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_step5.jpg" alt="finding stations step 1" width="418" height="411" /></p>
<p>When you are searching for the URLs to use look for URLs that point to .asx files – these are files that the player can play. A search such as <em>BBC radio direct link asx</em> , for example, will help you locate direct links for BBC radio streams.</p>
<p><img class="aligncenter size-full wp-image-266" title="VB_Radio_player_step6" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_step6.jpg" alt="finding stations to play step 2" width="557" height="216" /></p>
<p>For each radio stream, add a button to the form, set the button’s Text property to the name of the station and then add the code that links to that stream so it will play in the player. The only change from one button to the next is the URL of the stream.</p>
<p><img class="aligncenter size-full wp-image-267" title="VB_Radio_player_step7" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_Radio_player_step7.jpg" alt="finding stations to play step 3" width="413" height="398" /></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/create-a-visual-basic-radio-player/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://abc.net.au/res/streaming/audio/windows/triple_j.asx" length="0" type="video/asf" />
<enclosure url="http://www.bbc.co.uk/radio/listen/live/r1.asx" length="0" type="video/asf" />
		</item>
		<item>
		<title>Visual Basic Project</title>
		<link>http://xtremetips.com/visual-basic-project/</link>
		<comments>http://xtremetips.com/visual-basic-project/#comments</comments>
		<pubDate>Mon, 07 May 2012 20:26:05 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[alarm clock]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=256</guid>
		<description><![CDATA[Learn how to create an alarm application for your system tray. One of the cool things about Visual Basic is that it’s very easy to create quite sophisticated looking applications with only a few lines of code. Here I’ll show you how to create a program that sits in your system tray and runs a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_opener.jpg"><img class="aligncenter size-full wp-image-257" title="VB_alarm_in_the_system_tray_opener" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_opener.jpg" alt="visual basic project: alarm clock" width="200" height="100" /></a></p>
<p><em>Learn how to create an alarm application for your system tray.</em></p>
<p>One of the cool things about Visual Basic is that it’s very easy to create quite sophisticated looking applications with only a few lines of code. Here I’ll show you how to create a program that sits in your system tray and runs a small alarm timer.  It looks way more complicated than it is.</p>
<p>To get started on this application, choose File &gt; New Project and select the Windows Form application, call the project MyAlarm and click Ok. On the form, add a button and a label. Set the Form1 text property to My Alarm and set the Button1 Text property to “Minimise to tray”. Set the Label1 Text property to “Click to minimize to tray, then run application to select alarm time”, set its AutoSize property to False, set its Size to 150,40 and set its TextAlign property to MiddleCenter.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_step1.jpg"><img class="aligncenter size-full wp-image-258" title="VB_alarm_in_the_system_tray_step1" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_step1.jpg" alt="step 1" width="321" height="272" /></a></p>
<p>You’ll need some extra objects so, from the Tools list locate the NotifyIcon tool in the Common Controls and drag and drop it onto the form. It will appear in the container area below the form. Add the Timer from the Components list and a ContextMenuStrip from the Menus &amp; Toolbars collection. Select NotifyIcon1 and set its icon property to point to an icon file from your system – it needs to be a  .ico format file. Set the Text property to read My Personal Alarm and, still in the NotifyIcon1’s properties, select the ContextMenu property and set this to ContextMenuStrip1 which is the context menu strip you just added. Make sure that the Visible property for NotifyIcon1 is set to True.</p>
<p>Click the ContextMenuStrip icon below the form and a small context menu will appear on your form. Don’t worry about its placement as it won’t be staying there. Set the first option in the strip to read 10 Minute Alarm and the second one to read Exit.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_step2.jpg"><img class="aligncenter size-full wp-image-259" title="VB_alarm_in_the_system_tray_step2" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_step2.jpg" alt="visaual basic alarm step 2" width="564" height="183" /></a></p>
<p>Double click the 10 Minute Alarm option and, between its Sub and End Sub statements type this code:</p>
<pre>Dim myalarm
myalarm = 10
Timer1.Interval = myalarm * 1000
Timer1.Enabled = True</pre>
<p>Return to the &#8216;ContextMenuStrip&#8217;, double click the Exit entry and, between its Sub and End Sub statements type:</p>
<pre>NotifyIcon1.Visible = False
End</pre>
<p>Double click the Timer1 icon and between its Sub and End Sub statements type:</p>
<pre>Timer1.Enabled = False
MessageBox.Show("Your 10 minutes is up!", "Alarm Reminder", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)</pre>
<p>Double click Form1 and between its Sub and End Sub statements type:</p>
<pre>NotifyIcon1.Visible = False</pre>
<p>Double click Button1 and between its Sub and End Sub statements type:</p>
<pre>NotifyIcon1.Visible = True
Me.Hide()</pre>
<p>Double click the NotifyIcon1 icon and between its Sub and End Sub statements type:</p>
<pre>Me.Show()
NotifyIcon1.Visible = False</pre>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_step3.jpg"><img class="aligncenter size-full wp-image-260" title="VB_alarm_in_the_system_tray_step3" src="http://xtremetips.com/wp-content/uploads/2012/05/VB_alarm_in_the_system_tray_step3.jpg" alt="code for alarm clock in visual basic" width="516" height="532" /></a></p>
<p>Save you project and run it to test it.</p>
<p>When you run it you will see a small form appear on the screen. Click the button to minimize the form to the system tray where your icon now appears. If you hold your mouse over the system tray icon you’ll see the text tool tip appear. To set the timer, right click the system tray icon  and select the 10 minute alarm. Note that selecting the 10 minute alarm, right now, runs a 10 second alarm – it’s been set to a short length of time so you can tell if the program works or not. When the alarm time expires, a reminder appears on the screen. Click the Ok button to close the message box.</p>
<p>The program remains in the system tray so that you can set the alarm for a further period of time or click Exit to close it. When you exit the program, the icon is removed and the program closed.</p>
<p>Later, when you’re happy with the program, set the timer to a 10 minute interval by editing the code to read:</p>
<pre>Timer1.Interval = myalarm * 1000 * 60</pre>
<p>Save and build the project and you can then run it to use it as a short term timer application any time you need one. You can also adapt the basic functionality of this project to run a range of handy applications from your computer’s system tray.</p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/visual-basic-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Doodle Program &#8211; part 3</title>
		<link>http://xtremetips.com/create-a-doodle-program-part-3/</link>
		<comments>http://xtremetips.com/create-a-doodle-program-part-3/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 23:01:26 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[2005]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[brushes]]></category>
		<category><![CDATA[doodle]]></category>
		<category><![CDATA[drawgraphics]]></category>
		<category><![CDATA[drawing program]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[part 3]]></category>
		<category><![CDATA[pens]]></category>
		<category><![CDATA[picture control]]></category>
		<category><![CDATA[system.drawing]]></category>
		<category><![CDATA[Visual Basic Express Edition]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=222</guid>
		<description><![CDATA[In this final part of the series on creating a doodle application in Visual Basic I&#8217;ll show you how to add functionality in the form of ellipses and rectangles which can be created as filled or unfilled shapes. I&#8217;ll also show you how to add separate line colour and fill colour options and a two [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_final_design.jpg"><img class="aligncenter  wp-image-249" title="visual_basic_express_doodle_program_final_design" src="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_final_design.jpg" alt="final design" width="474" height="381" /></a></p>
<p>In this final part of the series on creating a doodle application in Visual Basic I&#8217;ll show you how to add functionality in the form of ellipses and rectangles which can be created as filled or unfilled shapes. I&#8217;ll also show you how to add separate line colour and fill colour options and a two extra colours: black and white.</p>
<p>If you missed them, here are links to <a title="doodle program part 1" href="http://xtremetips.com/create-a-doodle-program-part-1/">Part 1</a> and <a title="doodle program part 2" href="http://xtremetips.com/create-a-doodle-program-part-2/">Part 2</a>.</p>
<p>To add the new functionality to the doodler, add two new buttons which will become Button10 and Button11 for the black and white colour buttons – set their BackColor properties to black and white respectively and remove the text from the buttons&#8217; Text properties.</p>
<p>Extend the Line Style GroupBox to fit two new RadioButtons; RadioButton6 &#8211; set its Text property to Rectangle and RadioButton7 – set its Text property to Ellipse.</p>
<p>Add a new GroupBox and place in it RadioButton8 – set its Text property to Line Colour and its Checked property to True and RadioButton9 – set its Text property to Fill Colour. Set the GroupBox text property to Line/Fill.</p>
<p>Alongside the Line Colour RadioButton add Button12 – set its BackColor to MediumSlateBlue and alongside the Fill Colour add Button13 – set its BackColor to Crimson. Remove the text from both buttons&#8217; Text properties and set their FlatStyle to read Popup.</p>
<p>Add Button14 alongside the other color buttons, remove its Text property – it will become the new No fill button.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_form.jpg"><img class="aligncenter  wp-image-246" title="visual_basic_express_doodle_program_form" src="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_form.jpg" alt="doodle program form" width="440" height="406" /></a></p>
<h1>Create your NoFill image</h1>
<p>In your graphics software create an image the same size as your buttons – mine are 28 x 26 pixels in size. Set up the image with a white background and a red line diagonally across it. Save it calling it nofill.bmp – you can pay and download mine <a href="#download">here.</a></p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_nofill.jpg"><img class="aligncenter size-full wp-image-247" title="visual_basic_express_doodle_program_nofill" src="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_nofill.jpg" alt="no fill" width="264" height="339" /></a></p>
<p>In VB, double click My Project in the Solution Explorer and click the Resources category. From the Add Resource dropdown list select Add Existing File and add your nofill.bmp image. Make sure it is called noFill in the Solution Explorer. Set the Image property for Button14 to the noFill.bmp image.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_resourcesl.jpg"><img class="aligncenter size-full wp-image-248" title="visual_basic_express_doodle_program_resourcesl" src="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_resourcesl.jpg" alt="resources" width="409" height="391" /></a></p>
<h1>Creating the code</h1>
<p>The code changes begin with replacing some of the existing Declaration statements and adding some new ones:</p>
<p>&nbsp;</p>
<pre>Dim xStart, yStart, xEnd, yEnd, recWidth, recHeight As Integer
Dim myColour As Color
Dim myContinuousBrush As New Drawing.SolidBrush(Color.MediumSlateBlue)
Dim continuousFlag, shapeFill As Boolean</pre>
<pre></pre>
<p>Add two new procedures for drawing the rectangle and drawing the ellipse:</p>
<pre>Private Sub drawMyRectangle()
PictureBox1.Image = DrawBitmap
DrawGraphics.SmoothingMode = Drawing2D.SmoothingMode.None
recWidth = Math.Abs(xStart - xEnd)
recHeight = Math.Abs(yStart - yEnd)
If xStart &gt; xEnd Then xStart = xEnd
If yStart &gt; yEnd Then yStart = yEnd
If shapeFill = True Then
DrawGraphics.FillRectangle(myBrush, xStart, yStart, recWidth, recHeight)
End If
DrawGraphics.DrawRectangle(myPen, xStart, yStart, recWidth, recHeight)
End Sub</pre>
<p>&nbsp;</p>
<pre>Private Sub drawMyEllipse()
PictureBox1.Image = DrawBitmap
DrawGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
recWidth = Math.Abs(xStart - xEnd)
recHeight = Math.Abs(yStart - yEnd)
If xStart &gt; xEnd Then xStart = xEnd
If yStart &gt; yEnd Then yStart = yEnd
If shapeFill = True Then
DrawGraphics.FillEllipse(myBrush, New Rectangle(xStart, yStart, recWidth, recHeight))
End If
DrawGraphics.DrawEllipse(myPen, New Rectangle(xStart, yStart, recWidth, recHeight))
End Sub</pre>
<p>&nbsp;</p>
<p>When a rectangle or ellipse is drawn, the filled version is drawn first and then the unfilled version is drawn on top so the outside line shows. The rectangle draws between the place the mouse is pressed down and where it is lifted up and the ellipse is drawn inside a rectangle described in the same way. Both routines include a calculation that ensures the correct coordinates are used for the top left corner of the rectangle regardless of how you draw it.</p>
<p>Add this line to the Form1_Load event – it keeps track of whether you&#8217;re drawing a filled or unfilled shape:</p>
<p>&nbsp;</p>
<pre>shapeFill = True</pre>
<p>&nbsp;</p>
<p>Replace the If statement in the PictureBox1_MouseMove event with this code:</p>
<p>&nbsp;</p>
<pre>If continuousFlag Then
myContinuousBrush.Color = myPen.Color
DrawGraphics.SmoothingMode = Drawing2D.SmoothingMode.None
DrawGraphics.FillEllipse(myContinuousBrush, e.X, e.Y, myBrushWidth, myBrushWidth)
PictureBox1.Image = DrawBitmap
End If</pre>
<p>&nbsp;</p>
<p>The new features require us to make a distinction between the fill and the line colour so we need to ensure the continuous line is drawn using the line colour. Because the continuous line is really a series of small ellipses a new brush is required to manage its colour and to keep it separate from the fill colour.</p>
<p>Edit the <em>PictureBox1_MouseUp</em> code to include these new options to manage drawing the rectangles and ellipses:</p>
<p>&nbsp;</p>
<pre>If RadioButton1.Checked Then
continuousFlag = False
ElseIf RadioButton2.Checked Then
drawMyLine()
ElseIf RadioButton6.Checked Then
drawMyRectangle()
ElseIf RadioButton7.Checked Then
drawMyEllipse()
End If</pre>
<p>&nbsp;</p>
<p>Add this new procedure to handle the colour selectors:</p>
<p>&nbsp;</p>
<pre>Sub changeLineColour(ByVal myColour As Color)
If RadioButton8.Checked Then
myPen.Color = myColour
Button12.BackColor = myColour
Else
myBrush.Color = myColour
Button13.Image = Nothing
Button13.BackColor = myColour
shapeFill = True
End If
End Sub</pre>
<p>&nbsp;</p>
<p>Because each colour button now requires so much code it is better to remove the code to a separate procedure and call it from each button. This code checks to see which of the Line Colour or Fill Colour buttons is selected and it sets either the pen or the brush colour as required and sets the appropriate colour button too.</p>
<p>For the click event for each of Button4, Button5, Button6, Button7, Button8, Button9, Button10 and Button11 remove any existing code and replace it with this code:</p>
<p>&nbsp;</p>
<pre>myColour = Color.Orange
changeLineColour(myColour)</pre>
<p>&nbsp;</p>
<p>Change the colour in the first line to the colour of the button to which the code is attached. So, for the white colour button the first line would read myColour=color.white and so on.</p>
<p>To the Button14_click event  (the no fill button), add this code:</p>
<p>&nbsp;</p>
<pre>shapeFill = False
Button13.BackColor = Color.White
Button13.Image = My.Resources.noFill</pre>
<p>&nbsp;</p>
<p>To the Button13_click event add this code:</p>
<p>&nbsp;</p>
<pre>RadioButton9.Checked = True</pre>
<p>&nbsp;</p>
<p>To the Button12_click event add this code:</p>
<p>&nbsp;</p>
<pre>RadioButton8.Checked = True</pre>
<p>&nbsp;</p>
<p>To the RadioButton8_CheckedChange event add this code:</p>
<p>&nbsp;</p>
<pre>Button14.Enabled = False</pre>
<p>&nbsp;</p>
<p>To the RadioButton9_CheckedChange event add this code:</p>
<p>&nbsp;</p>
<pre>Button14.Enabled = True</pre>
<p>&nbsp;</p>
<p><a id="download">When you are done, save the project and run it. You should now be able to select a line and a fill colour and draw rectangles and ellipses to your Doodle application.</a></p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_final_design.jpg"><img class="aligncenter  wp-image-249" title="visual_basic_express_doodle_program_final_design" src="http://xtremetips.com/wp-content/uploads/2012/03/visual_basic_express_doodle_program_final_design.jpg" alt="final design" width="474" height="381" /></a></p>
<p>Want to save yourself some typing? Pay 1.99$ and download the all the code for all three parts  as three separate text files as well as the entire doodle program, code and resources itself!</p>
<p><a class="ec_ejc_thkbx" onclick="javascript:return EJEJC_lc(this);" href="https://www.e-junkie.com/ecom/gb.php?c=cart&amp;i=1071100&amp;cl=204628&amp;ejc=2" target="ej_ejc"><img src="http://www.e-junkie.com/ej/ej_add_to_cart.gif" alt="Add to Cart" border="0" /></a>   <a class="ec_ejc_thkbx" onclick="javascript:return EJEJC_lc(this);" href="https://www.e-junkie.com/ecom/gb.php?c=cart&amp;cl=204628&amp;ejc=2" target="ej_ejc"><img src="http://www.e-junkie.com/ej/ej_view_cart.gif" alt="View Cart" border="0" /></a><br />
<script type="text/javascript" language="javascript">// <![CDATA[
    function EJEJC_lc(th) { return false; }
// ]]&gt;</script><br />
<script type="text/javascript" src="http://www.e-junkie.com/ecom/box.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/create-a-doodle-program-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Doodle Program part &#8211; 2</title>
		<link>http://xtremetips.com/create-a-doodle-program-part-2/</link>
		<comments>http://xtremetips.com/create-a-doodle-program-part-2/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 21:41:04 +0000</pubDate>
		<dc:creator>Helen Bradley</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[2005]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[brushes]]></category>
		<category><![CDATA[doodle]]></category>
		<category><![CDATA[drawgraphics]]></category>
		<category><![CDATA[drawing program]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[pens]]></category>
		<category><![CDATA[picture control]]></category>
		<category><![CDATA[system.drawing]]></category>
		<category><![CDATA[Visual Basic Express Edition]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=178</guid>
		<description><![CDATA[Finished part 1? Now it&#8217;s time to add some extra functionality to your Visual Basic Doodler application. In the previous article in this series we created a simple doodle application so you could draw lines in a picture box. This time I&#8217;ll show you how to add extra functions to the project including a save [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_starter1.jpg"><img class="aligncenter  wp-image-181" title="vb_doodle_drawing_program_starter" src="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_starter1.jpg" alt="doodle program starter" width="386" height="365" /></a></p>
<p><em>Finished <a title="doodle program part 1" href="http://xtremetips.com/create-a-doodle-program-part-1/" target="_blank">part 1</a>? Now it&#8217;s time to add some extra functionality to your Visual Basic Doodler application.</em></p>
<p>In the previous article in <a title="doodle program part 1" href="http://xtremetips.com/create-a-doodle-program-part-1/" target="_blank">this series</a> we created a simple doodle application so you could draw lines in a picture box. This time I&#8217;ll show you how to add extra functions to the project including a save feature, smarter continuous drawing and the ability to select a colour and line width.</p>
<p>Add the functionality</p>
<p>Start by adding these new declarations to the declarations area of the project:</p>
<pre>Dim myColour As Color = Color.Blue
Dim myBrush As New Drawing.SolidBrush(Color.Red)
Dim myBrushWidth As Integer
Dim continuousFlag As Boolean</pre>
<p>To the end of the Form1_Load event handler, add these two lines:</p>
<pre>DrawGraphics.Clear(Color.White)
myBrushWidth = 4</pre>
<p>The first line is required to overcome a problem you will have when saving the doodle. Without it, the saved image will have a black background and this line of code solves the problem by ensuring a white background for the image.</p>
<p>Add two radio buttons inside a group box – change RadioButton1&#8242;s text property to Continuous and RadioButton2&#8242;s text property to Line by Line. Set the checked property for the Line by Line radio button to True as it is the default setting. Add this code to your PictureBox 1_MouseDown event:</p>
<pre>If RadioButton1.Checked Then
continuousFlag = True
End If</pre>
<p>This is part of the new continuous drawing feature and checks to see if Continuous drawing is selected and sets the continuousFlag variable if it is.</p>
<p>Add a new PictureBox1_MouseMove event and add this code to it:</p>
<pre>If continuousFlag Then
DrawGraphics.SmoothingMode = Drawing2D.SmoothingMode.None
DrawGraphics.FillEllipse(myBrush, e.X, e.Y, myBrushWidth, myBrushWidth)
PictureBox1.Image = DrawBitmap
End If</pre>
<p>This code handles continuous drawing and it &#8216;draws&#8217; by painting a series of filled ellipses along the mouse path. The technique is such that the faster the mouse moves, the more distance there is between the ellipses.</p>
<p>In the PictureBox1.MouseUp event, replace the drawMyLine()statement with this code:</p>
<pre>If RadioButton1.Checked Then
continuousFlag = False
Else
drawMyLine()
End If</pre>
<p>Now we have two drawing options – one is the new continuous line and the other is the original doodler program line drawing tool. The setting of the continuousFlag variable ensures that the continuous line drawn only if the left mouse button is depressed and the mouse is moved. As soon as you let go the left mouse button drawing ceases but will continue as soon as you press the left mouse button and move the mouse again.</p>
<p>Add this as a last line in the Button1_Click event handler:</p>
<pre>DrawGraphics.Clear(Color.White)</pre>
<p>This is the same code as you added to the Form1_Load event and is needed to ensure the PictureBox has a preset background colour &#8211; in this case white – so the colour is saved when you save the doodle. This code manages the new drawing when you press the Clear button.</p>
<p>Add a new button (Button3), and set its Text property to Save. Double click the button and add this code to its Button3_click event handler:</p>
<pre>Dim SaveFileDialog1 As New SaveFileDialog()
SaveFileDialog1.Filter = "bmp files (*.bmp)|*.bmp|All files (*.*)|*.*"
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
End If</pre>
<p>This accesses the Windows Save File dialog to make it easy and quick for you to save your doodle. Where possible, use Windows dialogs instead of coding the solution yourself – the Windows dialogs make projects look great, they save you time and effort and they are familiar to users.</p>
<p>To control colour, add six small buttons to the form. Set each button’s backcolor property to a colour selected from the Web tab and note the colour you used. This is the colour you will set the pen and brush to when the colour is selected.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_buttons.jpg"><img class="aligncenter  wp-image-182" title="vb_doodle_drawing_program_buttons" src="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_buttons.jpg" alt="buttons" width="410" height="322" /></a></p>
<p>For each button set its Text property to nothing at all as you want colour not words here. Use the Format &gt; Align &gt; Make Same Size and Vertical and Horizontal Spacing options to adjust the spacing of the buttons so they look neat. For each button add and this code to its button_click event adjusting the colour name as required:</p>
<pre>myPen.Color = Color.Turquoise
myBrush.Color = Color.Turquoise</pre>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_colors.jpg"><img class="aligncenter  wp-image-180" title="vb_doodle_drawing_program_colors" src="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_colors.jpg" alt="colors" width="248" height="430" /></a></p>
<p>Finish the form with another GroupBox (set its text property to Line Width) and add three radio buttons. Set the text property of the first to Thin, the second to Medium and the third to Thick. Set the Checked property for the Thin radio button to True. Add this code to the Thin button&#8217;s Click event:</p>
<pre>myPen.Width = 3
myBrushWidth = 4</pre>
<p>Do the same for each of the other buttons – using values of 6 and 7 for the Medium and values of 10 and 12 for the Thick.</p>
<p>Now you have made these changes to your application, save and run it. Click the Continuous button and click and drag to draw in the dialog. Click to change colour and line thickness and test the save routine too.</p>
<p>In the <a title="doodle program part3" href="http://xtremetips.com/create-a-doodle-program-part-3/" target="_blank">final part</a> of this series I&#8217;ll show you how to add some extra functionality and some final touches to the application.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Want to save yourself some typing? Pay 1.99$ and download the all the code for all three parts  as three separate text files as well as the entire doodle program, code and resources itself!</p>
<p><a class="ec_ejc_thkbx" onclick="javascript:return EJEJC_lc(this);" href="https://www.e-junkie.com/ecom/gb.php?c=cart&amp;i=1071100&amp;cl=204628&amp;ejc=2" target="ej_ejc"><img src="http://www.e-junkie.com/ej/ej_add_to_cart.gif" alt="Add to Cart" border="0" /></a>   <a class="ec_ejc_thkbx" onclick="javascript:return EJEJC_lc(this);" href="https://www.e-junkie.com/ecom/gb.php?c=cart&amp;cl=204628&amp;ejc=2" target="ej_ejc"><img src="http://www.e-junkie.com/ej/ej_view_cart.gif" alt="View Cart" border="0" /></a><br />
<script type="text/javascript" language="javascript">// <![CDATA[
 function EJEJC_lc(th) { return false; }
// ]]&gt;</script><br />
<script type="text/javascript" src="http://www.e-junkie.com/ecom/box.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/create-a-doodle-program-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create a Doodle program – Part 1</title>
		<link>http://xtremetips.com/create-a-doodle-program-part-1/</link>
		<comments>http://xtremetips.com/create-a-doodle-program-part-1/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 20:30:17 +0000</pubDate>
		<dc:creator>Helen Bradley</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[2005]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[brushes]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[doodle]]></category>
		<category><![CDATA[drawgraphics]]></category>
		<category><![CDATA[drawing program]]></category>
		<category><![CDATA[express edition]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[free visual basic]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[pens]]></category>
		<category><![CDATA[picture control]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[system.drawing]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[visual basic 2010]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=170</guid>
		<description><![CDATA[&#160; Follow these instructions to create a doodling program in Visual Basic Express 2010. This is a VB 2010 Express Edition program that lets you to doodle onto the screen. The program starts with a small window that you can draw on by dragging with the mouse. A line is drawn between the point you [...]]]></description>
			<content:encoded><![CDATA[<div>
<h1><a href="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_starter.jpg"><img class="aligncenter  wp-image-173" title="vb_doodle_drawing_program_starter" src="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_starter.jpg" alt="building a doodle program" width="312" height="366" /></a></h1>
<p>&nbsp;</p>
<p><em>Follow these instructions to create a doodling program in Visual Basic Express 2010.</em></p>
</div>
<p>This is a VB 2010 Express Edition program that lets you to doodle onto the screen. The program starts with a small window that you can draw on by dragging with the mouse. A line is drawn between the point you click on the drawing area and the point where you lift your mouse cursor from the drawing area. If you don&#8217;t like what you&#8217;ve drawn, click the Clear button and start over.</p>
<p>To create this application, start a new Visual Basic 2010 application – you can download the program from here (<a title="visual basic 2010 express download" href="http://bit.ly/vbexpressdownload" target="_blank">http://bit.ly/vbexpressdownload</a>) &#8211; and choose Windows Forms Application, type the name Doodler and click Ok. Enlarge the form on the screen to around half again its existing size.</p>
<p>Drag two buttons long the bottom edge of the form. Click one button and Shift + click on the second one and choose Format &gt; Make Same Size &gt; Both and then Format &gt; Align &gt; Tops to align the buttons and size them. Click the PictureBox control and drag a large PictureBox inside the form. The PictureBox should be almost the full width of the form and it should sit just above the buttons.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_form.jpg"><img class="aligncenter  wp-image-172" title="vb_doodle_drawing_program_form" src="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_form.jpg" alt="picture box placement" width="333" height="417" /></a></p>
<p>Right click the PictureBox, select Properties and set the BackColor to a light or white color. Double click the form to open the code window for the form. Type this code in the General &gt; Declarations section.</p>
<pre>Dim xStart, yStart, xEnd, yEnd As Integer
Dim DrawBitmap As Bitmap
Dim DrawGraphics As Graphics
Dim myPen As New Pen(Color.BlueViolet, 3)</pre>
<p>Add this code to the Form_Load event. It creates a new drawing in the PictureBox control which is where the line drawing will take place:</p>
<pre>drawbitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height)
drawgraphics = Graphics.FromImage(drawbitmap)
PictureBox1.Image = DrawBitmap</pre>
<p>The code that does the actual drawing is this MyLine subroutine which you can type now. You can call this code anytime you need to draw a line. This program records the starting point when you click the mouse button and the ending point when you let it go. This routine draws the actual line between the two points. Regardless of whether the mouse is moved in a curve or a straight line – the routine always draws a straight line.</p>
<pre>Private Sub drawMyLine()
PictureBox1.Image = DrawBitmap
DrawGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
DrawGraphics.DrawLine(myPen, xStart, yStart, xEnd, yEnd)
End Sub</pre>
<p>The color and size of the line are set up using the Pen object in the General Declarations area. Here you can change the line color and width by replacing the statement with something like this:</p>
<pre>Dim myPen As New Pen(Color.Red, 5)</pre>
<p>Add this code to the PictureBox1_MouseDown event.</p>
<p>&nbsp;</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_event.jpg"><img class="aligncenter size-full wp-image-171" title="vb_doodle_drawing_program_event" src="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_event.jpg" alt="putting in code" width="444" height="337" /></a></p>
<p>&nbsp;</p>
<p>When added to the MouseDown event this code calculates the value of the mouse pointer&#8217;s X and Y coordinates. It uses the Control.MousePosition property to return the absolute screen position for the mouse pointer. From this, the code subtracts the distance in from the left or the top of the screen of the form, the distance between the PictureBox and the form and the number of pixels of space consumed by the edge of the form and the title bar (4 and 31 pixels respectively).</p>
<pre>xStart = Control.MousePosition.X - (Me.Left + PictureBox1.Left + 4)
yStart = Control.MousePosition.Y - (Me.Top + PictureBox1.Top + 31)
' to do continuous drawing, enable this line
' drawMyLine()</pre>
<p>Type this next code into the PictureBox_MouseUp event handler. As with the MouseDown event this code retrieves the end X and Y coordinates for the end position of the mouse when you have dragged it and you let it go. These coordinates are calculated relative to the PictureBox. This event handler also takes care of drawing the line as it includes a call to the drawMyLine subroutine.</p>
<pre>xEnd = Control.MousePosition.X - (Me.Left + PictureBox1.Left + 4)
yEnd = Control.MousePosition.Y - (Me.Top + PictureBox1.Top + 31)
drawMyLine()</pre>
<p>The remaining code for the form is for the buttons. In the Button2_Click event type this:</p>
<pre>End</pre>
<pre></pre>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_code.jpg"><img class="aligncenter  wp-image-174" title="vb_doodle_drawing_program_code" src="http://xtremetips.com/wp-content/uploads/2012/02/vb_doodle_drawing_program_code.jpg" alt="code" width="381" height="403" /></a></p>
<p>In the Button1_Click event type this code which resets the PictureBox so you can create a new image. This is a repeat of the code from the Form1_Load event:</p>
<pre>DrawBitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height)
DrawGraphics = Graphics.FromImage(DrawBitmap)
PictureBox1.Image = DrawBitmap</pre>
<p>Once you have created the code, name the buttons Clear and Exit, name the form Doodler and test the application to check that it works. Test the Exit button to make sure that it exits the application. To draw, hold your mouse over the white picture area on the screen and click and drag to draw a line. Every time you click and drag, a new line will be added to the image. To clear the image and start again click the Clear button.</p>
<p>In the next installment I&#8217;ll add some extra functionality to the project including a save feature, I&#8217;ll improve the continuous drawing and add a tool for selecting a color and line width.</p>
<p>Want to save yourself some typing? Pay 1.99$ and download the all the code for all three parts  as three separate text files as well as the entire doodle program, code and resources itself!</p>
<p><a class="ec_ejc_thkbx" onclick="javascript:return EJEJC_lc(this);" href="https://www.e-junkie.com/ecom/gb.php?c=cart&amp;i=1071100&amp;cl=204628&amp;ejc=2" target="ej_ejc"><img src="http://www.e-junkie.com/ej/ej_add_to_cart.gif" alt="Add to Cart" border="0" /></a>  <a class="ec_ejc_thkbx" onclick="javascript:return EJEJC_lc(this);" href="https://www.e-junkie.com/ecom/gb.php?c=cart&amp;cl=204628&amp;ejc=2" target="ej_ejc"><img src="http://www.e-junkie.com/ej/ej_view_cart.gif" alt="View Cart" border="0" /></a></p>
<p><script type="text/javascript" language="javascript">// <![CDATA[
   function EJEJC_lc(th) { return false; }
// ]]&gt;</script><br />
<script type="text/javascript" src="http://www.e-junkie.com/ecom/box.js"></script></p>
<p>continue the tutorial here with <a title="doodle program part 2" href="http://xtremetips.com/create-a-doodle-program-part-2/">part 2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/create-a-doodle-program-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Excel:  Print Right</title>
		<link>http://xtremetips.com/excel-print-right/</link>
		<comments>http://xtremetips.com/excel-print-right/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 18:02:56 +0000</pubDate>
		<dc:creator>Helen Bradley</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Excell]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[hit the big red switch]]></category>
		<category><![CDATA[inconvenient page breaks]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[missing column headings]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[print a chart]]></category>
		<category><![CDATA[print multiple sheets on a page]]></category>
		<category><![CDATA[print preview]]></category>
		<category><![CDATA[selecting what to print]]></category>
		<category><![CDATA[shrink to fit]]></category>
		<category><![CDATA[spreadsheet]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[understand what prints]]></category>
		<category><![CDATA[use print preview]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=154</guid>
		<description><![CDATA[&#160; If you’re like me, you have a litany of Excel printing horror stories to tell. It seems that when things go wrong when printing an Excel worksheet they never go wrong by halves – it is usually a spectacular disaster. Hit the big red switch Well your printer probably doesn&#8217;t have a big red [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>If you’re like me, you have a litany of Excel printing horror stories to tell. It seems that when things go wrong when printing an Excel worksheet they never go wrong by halves – it is usually a spectacular disaster.</p>
<h1>Hit the big red switch</h1>
<p>Well your printer probably doesn&#8217;t have a big red switch but it will have an OFF button. When the printer starts coughing up pages of unwanted garbage &#8211; hit the off switch, cancel the print job and then start hunting for the problem.</p>
<p>To help you, I&#8217;ve put together my best tips and troubleshooting techniques for printing right in Excel – every time.</p>
<h1>Understand what prints</h1>
<p>When you click the Print button to print an Excel worksheet, Excel prints everything that’s on that worksheet. Sometimes there are cells filled that you may not realize are filled and the result is you will print pages you don&#8217;t mean to print.</p>
<h1>Use Print Preview</h1>
<p>Your first and best tool is the Print Preview option in Excel – it shows you how many pages will print and if you&#8217;re expecting one page and it&#8217;s preparing for 50 you know something is very wrong. In Excel 2010 things are easier than ever before and the print preview appears whenever you choose File &gt; Print.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_1.jpg"><img class="aligncenter  wp-image-159" title="Excel_troubleshoot_printing_problems_1" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_1.jpg" alt="print preview" width="455" height="327" /></a></p>
<h1>Selecting what to print</h1>
<p>One common problem in Excel is having a filled cell well out of view. You might have mistakenly moved to a faraway cell and typed something &#8211; even something as innocuous as a space is all it takes and that worksheet cell contains data. So, when you click the Print button, Excel will print everything up to and including the cell containing that space. To you it looks like reams of empty paper &#8211; to Excel it all makes perfect sense.</p>
<p>When this happens to you there are two choices – find and delete the problem cell or use a workaround. The workaround involves selecting the area to print before printing it. To do this, select the area to print and choose File &gt; Print – don&#8217;t click the Print icon if you have one. In Excel 2007 choose Office button &gt; Print &gt; Print Preview. When the Print dialog appears, click the Selection option and only the selected area will print.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_2.jpg"><img class="aligncenter  wp-image-160" title="Excel_troubleshoot_printing_problems_2" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_2.jpg" alt="choosing what to print" width="363" height="372" /></a></p>
<h1>Inconvenient page breaks</h1>
<p>Sometimes, when Excel divides up a large worksheet over a series of pages it doesn’t put the page break in the most sensible place. You can preview page breaks before you print and make adjustments to them by selecting the View &gt; Page Break Preview (View tab &gt; Page Break Preview in Excel 2007 and 2010). When you do this, you’ll see dashed lines on the screen showing the page breaks.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_3.jpg"><img class="aligncenter  wp-image-161" title="Excel_troubleshoot_printing_problems_3" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_3.jpg" alt="preview where page breaks will occur" width="428" height="534" /></a></p>
<p>To change a page break you can add your own but this must be done inside a current page so that you’re effectively making the page smaller. You can’t make a page longer or wider using this technique.</p>
<p>To add a manual page break, click and select the column or row which should trigger the page break and choose Insert &gt; Page Break (in Excel 2007 and  2010, choose Page Layout tab &gt; Page Breaks &gt; Insert Page Break). You can also drag on the dashed lines to move them around the screen and reorganize your page layout.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_4.jpg"><img class="aligncenter size-full wp-image-162" title="Excel_troubleshoot_printing_problems_4" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_4.jpg" alt="changing page breaks" width="548" height="381" /></a></p>
<h1>Missing column headings</h1>
<p>When a worksheet prints over multiple pages – all pages from page 2 onwards will be missing row or column headings or both. The data on the pages will be hard to understand unless you tape the pages together.</p>
<p>A better solution is to print column and row headings on every page and, to do this, choose Page Layout &gt; Print Titles to open the Page Setup dialog at the Sheet tab. Click in the Rows To Repeat At Top box and type the row letters in the format $1:$1 to print the first row or $1:$2 to print the first two rows on each page. In the Columns To Repeat At Left box, type $A:$A to print the first column as row headings or $A:$B to print the first two columns.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_5.jpg"><img class="aligncenter  wp-image-163" title="Excel_troubleshoot_printing_problems_5" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_5.jpg" alt="printing column titles" width="478" height="397" /></a></p>
<h1>Shrink to fit</h1>
<p>When a worksheet is only a little too big to print on a single sheet of paper, you can shrink it to fit. Choose File &gt; Print and choose an option from the Scaling list which probably currently shows as No Scaling.</p>
<p>Choose Fit Sheet on One Page to scale the sheet down so it all prints on one sheet of paper. Other options include Fit all Columns on One Page and Fit All Rows on One Page which scale the worksheet to fit either one page wide or one page lengthwise. Choose Custom Scaling Options if none of these settings is exactly what you need.</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_6.jpg"><img class="aligncenter size-full wp-image-155" title="Excel_troubleshoot_printing_problems_6" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_6.jpg" alt="shrink to fit" width="370" height="284" /></a></p>
<h1>Print multiple sheets on a page</h1>
<p>If you&#8217;ve tried to print part of one sheet and part of another on a single sheet of paper you know this is a futile exercise – Excel can&#8217;t do it because every sheet prints on new page even if it contains only a few cells of data.</p>
<p>There is a workaround that involves using the Camera tool to take a snapshot of the worksheet areas you want to print and place these on a single worksheet for printing.</p>
<p>To add the Camera tool to the QAT (Quick Access Toolbar), choose Options &gt; Quick Access Toolbar and from the dropdown list choose Commands Not in the Ribbon, locate the Camera and click Add to add it to the QAT.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_7.jpg"><img class="aligncenter  wp-image-156" title="Excel_troubleshoot_printing_problems_7" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_7.jpg" alt="camera tool" width="439" height="317" /></a></p>
<p>Now select the first area to print, and take a picture of it by clicking the Camera icon. Move to a new worksheet and click where the snapshot image should appear. Immediately you click on the spreadsheet a snapshot of what you captured will be inserted.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_8.jpg"><img class="aligncenter  wp-image-157" title="Excel_troubleshoot_printing_problems_8" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_8.jpg" alt="selecting camera area" width="455" height="345" /></a></p>
<p>Now go back and take a snapshot of the other worksheet and add it to your new sheet. You can do this as many times as you need to. Then print the worksheet and all the &#8216;snapshots&#8217; will print on the one page. Snapshots are live views so if the data in the original sheet changes then the snapshot will change too.</p>
<h1>Print a chart</h1>
<p>To print just a chart and not all the worksheet detail around it, click the chart to select it. Now choose File &gt; Print to locate all the options you have for sizing and printing your chart. When you click the Print button, only the chart will print.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_9.jpg"><img class="aligncenter  wp-image-158" title="Excel_troubleshoot_printing_problems_9" src="http://xtremetips.com/wp-content/uploads/2012/02/Excel_troubleshoot_printing_problems_9.jpg" alt="print the chart" width="455" height="386" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/excel-print-right/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 Cool Excel Chart Tips</title>
		<link>http://xtremetips.com/5-cool-excel-chart-tips/</link>
		<comments>http://xtremetips.com/5-cool-excel-chart-tips/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 17:29:21 +0000</pubDate>
		<dc:creator>Helen Bradley</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[add new data to a chart]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[control missing data]]></category>
		<category><![CDATA[Excell]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[multiple axes]]></category>
		<category><![CDATA[pictures in charts]]></category>
		<category><![CDATA[re-size chart bars]]></category>
		<category><![CDATA[spreadsheet]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=140</guid>
		<description><![CDATA[See how to tame unruly data by: - using multiple axes in Excel - adding pictures to charts - resize chart bars - add data to charts -deal with missing data Creating a basic chart in Excel is simple but when your data requires just a little bit extra attention to look its best, you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;">See how to tame unruly data by:</h1>
<p style="text-align: center;">- using multiple axes in Excel</p>
<p style="text-align: center;">- adding pictures to charts</p>
<p style="text-align: center;">- resize chart bars</p>
<p style="text-align: center;">- add data to charts</p>
<p style="text-align: center;">-deal with missing data</p>
<p>Creating a basic chart in Excel is simple but when your data requires just a little bit extra attention to look its best, you&#8217;ll need to delve into the depths of the Excel charting tools. Here I’ll show you five ways of taming unruly data in Microsoft Excel.</p>
<h1>Using Multiple Axes</h1>
<p>When you have a mix of data to use such as very large values and some very small ones like percentages you’ll find that the percentages disappear when they are plotted against the larger data values.</p>
<p>You can solve the problem by adding a second axis for the smaller values. To do this, click on the chart and then choose Chart Tools &gt; Layout tab and from the selector in the top left of the Ribbon select the chart series that you cannot see clearly on the chart. Then click the Format Selection icon which is directly below this.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_1.jpg"><img class="aligncenter  wp-image-144" title="hot_excel_chart_tips_and_techniques_1" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_1.jpg" alt="multiple axes" width="285" height="282" /></a></p>
<p>When the dialog appears click Series Options and click Secondary Axis to plot this series on a new axis which has a different scale applied to it.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_2.jpg"><img class="aligncenter  wp-image-145" title="hot_excel_chart_tips_and_techniques_2" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_2.jpg" alt="series options " width="346" height="257" /></a></p>
<p>Now, with the series still selected, select Chart Tools &gt; Design tab and choose Change Chart Type. Because you have only part of the chart selected whatever option you choose now will be applied to only the selected data series. Choose a contrasting chart type for this series to draw attention to the fact that it is plotted against a different axis. A good combination where you are using a column chart for the large values is to use a Line Chart for the very small values.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_3.jpg"><img class="aligncenter  wp-image-146" title="hot_excel_chart_tips_and_techniques_3" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_3.jpg" alt="chart apperance" width="342" height="232" /></a></p>
<p>To finish, from the Chart Tools &gt; Layout tab select Axes and name your primary and secondary vertical axes to indicate what is being displayed on those axes. Formatting the axis titles so they match the colour of the series plotted on them will help the reader understand your chart.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_4.jpg"><img class="aligncenter  wp-image-147" title="hot_excel_chart_tips_and_techniques_4" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_4.jpg" alt="titling axes" width="325" height="283" /></a></p>
<h1>Pictures in Charts</h1>
<p>Make your charts illustrate what their contents are all about by adding a picture to the chart. To do this click the chart to select it and, from the Chart Tools &gt; Format tab click the dropdown list in the top left corner and choose Plot Area to place the image behind the chart or choose Chart Area to fill the entire chart box with the image.</p>
<p>Choose either Format Selection which is immediately under the dropdown list. Select Fill and then click Picture or Texture Fill. Select File to open an image on your disk or choose Clip Art to use a clipart image. When you insert the image it will appear behind the chart. To make the picture partially transparent, adjust the transparency slider. If you place your image on the Chart Area you may want to select and set the Plot Area Fill to No Fill or make it partially transparent so you can see the image more clearly.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_5.jpg"><img class="aligncenter  wp-image-148" title="hot_excel_chart_tips_and_techniques_5" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_5.jpg" alt="pictures in charts" width="374" height="286" /></a></p>
<h1>Re-size<strong> Chart Bars</strong></h1>
<p>By default, Bar and Column charts are created with the bars and columns a preset width. If you would prefer the gaps to be smaller and the bars wider, you can do so. First choose Chart Tools &gt; Layout tab and select one of your chart series from the list. Then choose the Format Selection option immediately under this and select Series Options from the Format Data Series dialog. Adjust the Gap Width slider to make the space between bars or columns wider or narrower – if you make the gap narrower, the bars become wider and vice versa.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_6.jpg"><img class="aligncenter  wp-image-141" title="hot_excel_chart_tips_and_techniques_6" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_6.jpg" alt="chart bar re-size" width="418" height="318" /></a></p>
<h1>Overlap data in charts</h1>
<p>If you have plotted multiple series on your chart, you can overlap the bars or columns by dragging the Series Overlap slider towards Overlapped. This overlaps the bars or columns so they will be wider still as well as being overlapped.</p>
<h1>Add New Data to a chart</h1>
<p>In Excel 2003 and earlier versions you could add data to a chart by selecting the data and dragging and dropping it onto the chart. This behaviour was discontinued in Excel 2007 and 2010 making it more difficult than previously to add data to a chart.</p>
<p>One method of adding data to a chart in Excel 2007 and 2010 is to select the new data including the column heading if you previously included column headings in your chart data selection and click the Copy button on the Home tab of the ribbon. Now click on a data series in the chart and press Ctrl + V to paste the data into the chart.</p>
<p>The other method of adding data is to click the chart to select it and choose Chart Tools &gt; Design tab &gt; Select Data. In this dialog you will see the data that is already plotted in your chart. The series names appear in the panel on the left and the category or horizontal axis data appears in the right hand panel.</p>
<p>To add data, click the Add button and click on the series name to add – this is the cell or cells which contain the heading that should appear in the legend for this series. Then click in the Series Value box and select the data to include in the chart (but don&#8217;t include the headings you just selected). When you do this the chart will automatically expand to show the data that you have just added to it so you can check the results. Click Ok twice to finish.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_7.jpg"><img class="aligncenter  wp-image-142" title="hot_excel_chart_tips_and_techniques_7" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_7.jpg" alt="adding data to a chart" width="418" height="354" /></a></p>
<h1>Control Missing Data</h1>
<p>When your data is incomplete such as where some of it is missing you may find your chart looks strange because of the way Excel plots missing data. You can change the way that missing data is handled by clicking on the chart to select it and choose Chart Tools &gt; Design tab &gt; Select Data and click the Hidden and Empty Cells button.</p>
<p>A dialog appears with three options for plotting the empty cells: Gaps, Zero and Connect data points with line. Select the option that is best for your data and click Ok twice. All the data that is missing from your charted range will be dealt according to the option you selected.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_8.jpg"><img class="aligncenter  wp-image-143" title="hot_excel_chart_tips_and_techniques_8" src="http://xtremetips.com/wp-content/uploads/2012/02/hot_excel_chart_tips_and_techniques_8.jpg" alt="missing data control" width="371" height="294" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/5-cool-excel-chart-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>7 Cool &#8216;Must Know&#8217; Excel functions</title>
		<link>http://xtremetips.com/7-cool-must-know-excel-functions/</link>
		<comments>http://xtremetips.com/7-cool-must-know-excel-functions/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 16:49:55 +0000</pubDate>
		<dc:creator>Helen Bradley</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[calculating averages]]></category>
		<category><![CDATA[calculating workdays]]></category>
		<category><![CDATA[date function]]></category>
		<category><![CDATA[Excell]]></category>
		<category><![CDATA[finding roots]]></category>
		<category><![CDATA[helen bradley]]></category>
		<category><![CDATA[making choices]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[multiply and add]]></category>
		<category><![CDATA[referring to a cell]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://xtremetips.com/?p=126</guid>
		<description><![CDATA[At its heart, Excel 2010 is a great tool for making calculations and Excel functions are the key to getting the work done fast. Here I&#8217;ll show you some of the most effective functions that Excel has to help you make calculations using worksheet data. 1          Calculating workdays To calculate the number of days between [...]]]></description>
			<content:encoded><![CDATA[<p>At its heart, Excel 2010 is a great tool for making calculations and Excel functions are the key to getting the work done fast. Here I&#8217;ll show you some of the most effective functions that Excel has to help you make calculations using worksheet data.</p>
<h1>1          Calculating workdays</h1>
<p>To calculate the number of days between two dates and taking into account holidays use the =NETWORKDAYS function. Start by placing the dates for the holidays in a range of cells across a row or down a column. Select this range and name it holidays using Formulas &gt; Define Name.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_1.jpg"><img class="aligncenter  wp-image-130" title="7_must_know_excel_functions_1" src="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_1.jpg" alt="calculating number of workdays" width="359" height="325" /></a></p>
<p>This function will calculate the number of workdays between two dates placed in cell A1 and A2, taking into account the days you&#8217;ve described as being holidays:</p>
<p>=NETWORKDAYS(A1,A2,Holidays)</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_2.jpg"><img class="aligncenter  wp-image-131" title="7_must_know_excel_functions_2" src="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_2.jpg" alt="function =NETWORKDAYS(A1,A2,holidays)" width="379" height="158" /></a></p>
<p>If the NETWORKDAYS function returns an error make sure that you have the Analysis Toolpak installed by choosing File &gt; Options &gt; Add-ins &gt; Excel Add-ins &gt; Go.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_3.jpg"><img class="aligncenter  wp-image-132" title="7_must_know_excel_functions_3" src="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_3.jpg" alt="trouble shooting NETWORKDAYS function" width="409" height="254" /></a></p>
<p>Make sure the checkbox for the Add-in is selected:</p>
<p><a href="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_41.jpg"><img class="aligncenter size-full wp-image-128" title="7_must_know_excel_functions_4" src="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_41.jpg" alt="select analysis toolpack" width="288" height="232" /></a></p>
<h1>2          Calculating Averages</h1>
<p>The AVERAGE function can be used to calculate the average of a series of numbers. The syntax is =AVERAGE(<em>StartCell</em>:<em>EndCell</em>), where StartCell is the first cell in the range and EndCell is the last cell.</p>
<p>Be aware that when you make an AVERAGE calculation, blank (empty cells) are ignored. So, for example, the average of four cells, three of which contain the number four and one of which is blank, is four.</p>
<p>If you place a zero in the empty cell then the Average is 3. If you intend blank cells to represent the value zero you should place a zero in all empty cells before making the calculation.</p>
<p style="text-align: center;"><a href="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_5.jpg"><img class="aligncenter  wp-image-129" title="7_must_know_excel_functions_5" src="http://xtremetips.com/wp-content/uploads/2012/02/7_must_know_excel_functions_5.jpg" alt="blank cells vs zeros" width="398" height="300" /></a></p>
<h1>3          Date functions</h1>
<p>Two of Excel’s functions =NOW() and =TODAY() allow you to insert the current date and time or just the current date into a cell. If you do this and see a number of around 39,000 this is the number of days since the 1<sup>st</sup> of January 1900 and is how dates are calculated. Simply format this number as a date using the Format &gt; Cell &gt; Number Format options.</p>
<h1>4          Referring to a cell</h1>
<p>One difficulty which stumps even seasoned Excel users is how to refer to the contents of one cell in the current cell. For example, if cell A2 should contain the same contents as cell C2 simply type =C2 in cell A2. Linking cells like this ensures that when the value in C2 changes, the value in cell A2 will change to match it. You can achieve a similar result across worksheets by prefixing the cell reference with the worksheet name. For example, this formula refers to the contents of cell C2 on Sheet1: =Sheet1!C2.</p>
<h1>5          Multiply and Add</h1>
<p>Often when you are making calculations you need to multiply the contents of one column by the values in a second column and then add the results. You might do this, for example, if you have a list of product numbers in stock and you need to multiply these by the cost price and sum it to obtain an inventory value. To do this use the SUMPRODUCT function, the syntax of which is =SUMPRODUCT(<em>FirstRange,SecondRange</em>). For example, =SUMPRODUCT(A2:A25,B2:B25) will multiply each of the cells in the range in column A by the corresponding cell in the range in column B and then total the result.</p>
<h1>6          Making choices</h1>
<p>The IF function lets you make a choice in your worksheet. For example, if cell A2 contains a value of Y or N depending on whether a discount is applicable, you can use the value in that cell to calculate the discount in another cell. If the discount is 10% this formula will calculate the discount on a price in cell A3:</p>
<p>=IF(A2 =&#8221;Y&#8221;,0.1*A3, 0)</p>
<p>The formula checks cell A2 to see if a discount is to be allowed and, if so, the discount is calculated using the total price in cell A3. If not, the discount is set to 0.</p>
<h1>7          Finding Roots</h1>
<p>Excel has a special function SQRT for finding the square root of a number. So, for example, the square root of 25 can be calculated using =SQRT(25). There is, however, no corresponding function for calculating the cube or any other root of a number. You can, however, calculate this using a simple formula if you know that the square root of 25 can be written mathematically as =25^(1/2). By extension, the cube root can be calculated by typing =25^(1/3).</p>
]]></content:encoded>
			<wfw:commentRss>http://xtremetips.com/7-cool-must-know-excel-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

