<?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>Electronic Designer</title>
	<atom:link href="http://www.electronic-designer.co.uk/feed" rel="self" type="application/rss+xml" />
	<link>http://www.electronic-designer.co.uk</link>
	<description>Electronic Designer Resources</description>
	<lastBuildDate>Fri, 30 Mar 2012 13:27:07 +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>Convert String To Unicode Values</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/strings/convert-string-to-unicode-values</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/strings/convert-string-to-unicode-values#comments</comments>
		<pubDate>Fri, 02 Mar 2012 11:58:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Strings]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=802</guid>
		<description><![CDATA[String Conversion To Unicode Byte Array using namespace System::Text; Encoding ^Unicode1 = Encoding::Unicode; array&#60;Byte&#62; ^UnicodeBytes = Unicode1-&#62;GetBytes("1234"); //Produces: 0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00 Then To Convert To Unicode Words int Count; UInt16 UnicodeValue; for (Count = 0; Count &#60; UnicodeBytes-&#62;Length; Count += 2) { UnicodeValue = (UInt16)UnicodeBytes[Count]; UnicodeValue &#124;= ((UInt16)UnicodeBytes[(Count + 1)]) &#60;&#60; 8; txtOutput-&#62;Text += "&#" + UnicodeValue [...]]]></description>
			<content:encoded><![CDATA[<h4>String Conversion To Unicode Byte Array</h4>
<pre><code>
using namespace System::Text;

	Encoding ^Unicode1 = Encoding::Unicode;
	array&lt;Byte&gt; ^UnicodeBytes = Unicode1-&gt;GetBytes("1234");		//Produces: 0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00
</code></pre>
<p><span id="more-802"></span></p>
<h4>Then To Convert To Unicode Words</h4>
<pre><code>
	int Count;
	UInt16 UnicodeValue;
	for (Count = 0; Count &lt; UnicodeBytes-&gt;Length; Count += 2)
	{
		UnicodeValue = (UInt16)UnicodeBytes[Count];
		UnicodeValue |= ((UInt16)UnicodeBytes[(Count + 1)]) &lt;&lt; 8;
		txtOutput-&gt;Text += "&#" + UnicodeValue + ";";
	}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/strings/convert-string-to-unicode-values/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading From Excel</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/office/excel/reading-from-excel</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/office/excel/reading-from-excel#comments</comments>
		<pubDate>Fri, 02 Mar 2012 11:36:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Excel]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=798</guid>
		<description><![CDATA[Adding Excel Functionality To Your Project Add Microsoft Excel Reference Menu &#62; Project &#62; Properties &#62; Common Properties &#62; Add Reference &#62; .Net &#62; Microsoft.Office.Interop.Excel (choose the latest version) Add Namespaces using namespace Microsoft::Office::Core; //using namespace Microsoft::Office::Interop::Excel; //To avoid pain with errors due to clashes with "Application" by using this we use the below instead [...]]]></description>
			<content:encoded><![CDATA[<h4>Adding Excel Functionality To Your Project</h4>
<h5>Add Microsoft Excel Reference</h5>
<p>Menu &gt; Project &gt; Properties &gt; Common Properties &gt; Add Reference &gt; .Net &gt; Microsoft.Office.Interop.Excel (choose the latest version)<span id="more-798"></span></p>
<h5>Add Namespaces</h5>
<pre><code>
	using namespace Microsoft::Office::Core;
	//using namespace Microsoft::Office::Interop::Excel;		//To avoid pain with errors due to clashes with "Application" by using this we use the below instead
	using namespace Microsoft::Office::Interop;
</code></pre>
<h5>Create Object</h5>
<pre><code>
	private: Excel::Application ^ExcelApp1;

	ExcelApp1 = gcnew Excel::Application();
</code></pre>
<h4>Reading Cells In A Worksheet</h4>
<pre><code>
	try
	{
		txtOutput-&gt;Text = "";

		//----- OPEN EXCEL WORKBOOK -----
		Excel::Workbook ^WorkBook1 = ExcelApp1-&gt;Workbooks-&gt;Open("C:\\_Downloaded\\test.xlsx",
													 0,
													 true,
													 5,
													 "",
													 "",
													 true,
													 Excel::XlPlatform::xlWindows,
													 "\t",
													 false,
													 false,
													 0,
													 true,
													 1,
													 0);

		//----- OPEN THE WORKSHEET -----
		/* Use this if you need to deal with workbooks with multiple sheets
		int SheetNumber;
		for (SheetNumber = 1; SheetNumber &lt;= WorkBook1-&gt;Sheets-&gt;Count; SheetNumber++)
		{
		}
		*/
		Excel::Worksheet ^WorkSheet1 = (Excel::Worksheet^)WorkBook1-&gt;ActiveSheet;

		//If you don't know which cells your after you can use this:
		//Excel::Range ^ExcelRange1 = Sheet1-&gt;UsedRange;

		//----- READ WORKSHEET -----
		int RowIndex = 1;
		int ColumnIndex = 1;
		String ^CellValue;

		for (RowIndex = 1; RowIndex &lt;= 10; RowIndex++)
		{
			//----- READ NEXT ROW -----
			for (ColumnIndex = 1; ColumnIndex &lt;= 3; ColumnIndex++)
			{
				//----- READ NEXT COLUMN -----
				if (((Excel::Range^)WorkSheet1-&gt;Cells[(System::Object^)RowIndex, (System::Object^)ColumnIndex])-&gt;Value2 != nullptr)
				{
					//CELL HAS A VALUE
					CellValue = ((Excel::Range^)WorkSheet1-&gt;Cells[(System::Object^)RowIndex, (System::Object^)ColumnIndex])-&gt;Value2-&gt;ToString();

					txtOutput-&gt;Text += "'" + CellValue + "'";
				}
				else
				{
					//CELL IS BLANK
					txtOutput-&gt;Text += "#";
				}
			}
			txtOutput-&gt;Text += "\r\n";
		}

		//----- CLOSE WORKBOOK -----
		WorkBook1-&gt;Close(false, "C:\\_Downloaded\\test.xlsx", nullptr);

	}
	catch (Exception ^e)
	{
		MessageBox::Show(L"Error:\n" + e, L"Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
	}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/office/excel/reading-from-excel/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting Types</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/memory/converting-types</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/memory/converting-types#comments</comments>
		<pubDate>Fri, 24 Feb 2012 18:04:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Memory]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=794</guid>
		<description><![CDATA[&#160; Convert::To Single MySingle = Convert::ToSingle(SomeString); Internationalization &#8211; IMPORTANT!!! When converting from strings remember to deal with possible Internationalization issues for countries which use different characters, for instance like commas instead of decimal points &#8211; Convert::To doesn&#8217;t deal with this! See here &#160;]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<h4>Convert::To</h4>
<p>Single MySingle = Convert::ToSingle(SomeString);</p>
<h4>Internationalization &#8211; IMPORTANT!!!</h4>
<p><span id="more-794"></span></p>
<p>When converting from strings remember to deal with possible Internationalization issues for countries which use different characters, for instance like commas instead of decimal points &#8211; Convert::To doesn&#8217;t deal with this!</p>
<p><a href="http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/strings/value-internationalization-issues">See here</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/memory/converting-types/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Value Internationalization Issues</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/strings/value-internationalization-issues</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/strings/value-internationalization-issues#comments</comments>
		<pubDate>Fri, 24 Feb 2012 17:46:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Strings]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=791</guid>
		<description><![CDATA[Comma Instead Of Decimal Point In countries such as Germany they use commas as decimal points (e.g. -0,136222).  So if your program is converting a string like this: String ^sTemp; Single Value; sTemp = "1.234"; Value = Convert::ToSingle(sTemp); What you will actually get is 1234 in Value &#8211; the decimal point is ignored. Correctly Handling [...]]]></description>
			<content:encoded><![CDATA[<h4>Comma Instead Of Decimal Point</h4>
<p>In countries such as Germany they use commas as decimal points (e.g. -0,136222).  So if your program is converting a string like this:<span id="more-791"></span></p>
<pre><code>
	String ^sTemp;
	Single Value;
	sTemp = "1.234";
	Value = Convert::ToSingle(sTemp);
</code></pre>
<p>What you will actually get is 1234 in Value &#8211; the decimal point is ignored.</p>
<h5>Correctly Handling Conversions From Strings</h5>
<pre><code>
	String ^sTemp;
	Single Value;
	sTemp = "1.234";
	Value = Single::Parse(sTemp, System::Globalization::CultureInfo::InvariantCulture);
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/strings/value-internationalization-issues/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Class Variables and Objects Thread Safe</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/threads/making-class-variables-and-objects-thread-safe</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/threads/making-class-variables-and-objects-thread-safe#comments</comments>
		<pubDate>Fri, 24 Feb 2012 14:02:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Threads]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=785</guid>
		<description><![CDATA[Simple Locking Approach using namespace System::Threading; Create a flag private: bool ClassObjectsLocked; In your constructor set it up ClassObjectsLocked = false; Then in functions which want to alter values but may be on a different thread while (ClassObjectsLocked) Thread::Sleep(1); In functions which want to read values ClassObjectsLocked = true; ... ClassObjectsLocked = false;]]></description>
			<content:encoded><![CDATA[<h4>Simple Locking Approach</h4>
<pre><code>using namespace System::Threading;</code></pre>
<h5>Create a flag</h5>
<p><span id="more-785"></span></p>
<pre><code>	private: bool ClassObjectsLocked;</code></pre>
<h5>In your constructor set it up</h5>
<pre><code>	ClassObjectsLocked = false;</code></pre>
<h5>Then in functions which want to alter values but may be on a different thread</h5>
<pre><code>
	while (ClassObjectsLocked)
		Thread::Sleep(1);
</code></pre>
<h5>In functions which want to read values</h5>
<pre><code>
	ClassObjectsLocked = true;
	...
	ClassObjectsLocked = false;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/threads/making-class-variables-and-objects-thread-safe/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Z Order</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/forms/z-order</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/forms/z-order#comments</comments>
		<pubDate>Fri, 17 Feb 2012 13:43:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Forms]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=779</guid>
		<description><![CDATA[Force Label To Front MyLabel-&#62;BringToFront();]]></description>
			<content:encoded><![CDATA[<h4>Force Label To Front</h4>
<pre><code>
MyLabel-&gt;BringToFront();
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/forms/z-order/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set Form Position</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/forms/form-size-location/set-form-position</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/forms/form-size-location/set-form-position#comments</comments>
		<pubDate>Fri, 20 Jan 2012 11:40:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Form Size And Location]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=771</guid>
		<description><![CDATA[Set Form To Bottom Left //----- SET OUR POSITION BOTTOM LEFT ----- this-&#62;Left = Screen::PrimaryScreen-&#62;WorkingArea.Left; this-&#62;Top = Screen::PrimaryScreen-&#62;WorkingArea.Height - this-&#62;Height;]]></description>
			<content:encoded><![CDATA[<h4>Set Form To Bottom Left</h4>
<pre><code>
	//----- SET OUR POSITION BOTTOM LEFT -----
	this-&gt;Left = Screen::PrimaryScreen-&gt;WorkingArea.Left;
	this-&gt;Top = Screen::PrimaryScreen-&gt;WorkingArea.Height - this-&gt;Height;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/forms/form-size-location/set-form-position/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting Modifier Keys</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/keypresses/detecting-modifier-keys</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/keypresses/detecting-modifier-keys#comments</comments>
		<pubDate>Fri, 20 Jan 2012 09:10:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Keypresses]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=767</guid>
		<description><![CDATA[Detecting A Modifier Key Is Pressed if (Control::ModifierKeys == Keys::Control) Detecting A Single Modifier Key Is Pressed if (Control::ModifierKeys &#38; Keys::Shift) != 0)]]></description>
			<content:encoded><![CDATA[<h4>Detecting A Modifier Key Is Pressed</h4>
<pre><code>
if (Control::ModifierKeys == Keys::Control)
</code></pre>
<p><span id="more-767"></span></p>
<h4>Detecting A Single Modifier Key Is Pressed</h4>
<pre><code>
if (Control::ModifierKeys &amp; Keys::Shift) != 0)
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/keypresses/detecting-modifier-keys/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting Key Presses On A Form</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/keypresses/detecting-key-presses-on-a-form</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/keypresses/detecting-key-presses-on-a-form#comments</comments>
		<pubDate>Fri, 20 Jan 2012 09:08:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Keypresses]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=765</guid>
		<description><![CDATA[Select the form: Set the KeyPreview property of the form to true so that keyboard messages are received by the form before they reach any controls on the form. Create a KeyPress event (detects keys down combined with any modifier key &#8211; i.e. no event for pressing CTRL and a modified key value for CTRL [...]]]></description>
			<content:encoded><![CDATA[<p>Select the form:</p>
<p style="padding-left: 30px;">Set the KeyPreview property of the form to true so that keyboard messages are received by the form before they reach any controls on the form.</p>
<p><span id="more-765"></span></p>
<p style="padding-left: 30px;">Create a KeyPress event (detects keys down combined with any modifier key &#8211; i.e. no event for pressing CTRL and a modified key value for CTRL + &#8216;y&#8217;</p>
<p style="padding-left: 30px;">Or create a KeyDown event (detects every key down including modifier keys and gives individual key value)</p>
<h4>Example Handler</h4>
<pre><code>
	//***********************************
	//***********************************
	//********** FORM KEY DOWN **********
	//***********************************
	//***********************************
	private: System::Void frmMain_KeyDown(System::Object^  sender, System::Windows::Forms::KeyEventArgs^  e)
	{

		try
		{
			//MessageBox::Show("Form.KeyPress: '" + e-&gt;KeyValue.ToString() + "' pressed.");

			if ((Control::ModifierKeys == Keys::Control) &amp;&amp; (e-&gt;KeyValue == 'L'))		//Key values are for CAPS version of letters
			{

				//----- CTRL+L PRESSED -----
				textBox1-&gt;Text = "A";

			}
		}
		catch (Exception ^)
		{
		}
	}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/keypresses/detecting-key-presses-on-a-form/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chart Types</title>
		<link>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/charts/chart-types</link>
		<comments>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/charts/chart-types#comments</comments>
		<pubDate>Thu, 15 Dec 2011 18:38:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Charts]]></category>

		<guid isPermaLink="false">http://www.electronic-designer.co.uk/?p=749</guid>
		<description><![CDATA[Line Charts Displaying Points Series &#62; Marker Style]]></description>
			<content:encoded><![CDATA[<h4>Line Charts</h4>
<h5>Displaying Points</h5>
<p>Series &gt; Marker Style</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronic-designer.co.uk/programming/visual-cpp-cli-dot-net/charts/chart-types/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

