<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>CodeGuru Forums - C-Sharp Programming</title>
		<link>http://forums.codeguru.com/</link>
		<description>Post questions, answers, and comments about C#.</description>
		<language>en</language>
		<lastBuildDate>Sat, 18 May 2013 14:08:39 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forums.codeguru.com/images/misc/rss.png</url>
			<title>CodeGuru Forums - C-Sharp Programming</title>
			<link>http://forums.codeguru.com/</link>
		</image>
		<item>
			<title><![CDATA[[Tutorial] Switch..Case, Loops and 1D Arrays *Heavily Commented*]]></title>
			<link>http://forums.codeguru.com/showthread.php?537083-Tutorial-Switch..Case-Loops-and-1D-Arrays-*Heavily-Commented*&amp;goto=newpost</link>
			<pubDate>Sat, 18 May 2013 02:34:56 GMT</pubDate>
			<description><![CDATA[I've been learning C# for a while now and I just though this might be helpful to someone that wants to learn about these specific areas of C# although very simple stuff can be hard to understand to someone learning.

This also demonstrates a int to string work around 

I can do more upon request but if not, I hope this helps someone :).

*_WITHOUT COMMENTS_*

Code:
---------
class Program
    {
        static void Main(string[] args)
        {
            int[] ints = new int[5] {1, 4 , 11, 19, 22};

            string input;
            int inputText;

            input = Console.ReadLine();

            inputText = int.Parse(input);

            switch (inputText)
            {
                case 1:
                    {
                        for (int i = 0; i < ints.Length; i++)
                        {
                            Console.WriteLine("for Loop ints array {1}: {0}",ints[i] , i);
                        }
                        break;
                    }
                case 2:
                    {
                        foreach (int i in ints)
                        {
                            Console.WriteLine("foreach Loop ints array: {0}", i);
                        }
                        break;
                    }
                case 3:
                    {
                        int i = 0;
                        do
                        {
                            Console.WriteLine("do...while Loop ints array: {0}", ints[i]);
                            i++;
                        } while (i < 5);
                        break;
                    }

                case 4:
                    {
                        int i = 0;
                        while (i < 5)
                        {
                            Console.WriteLine("while Loop ints array: {0}", ints[i]);
                            i++;
                        }
                        break;
                    }
            }
            Console.ReadLine();
        }
    }
---------
*_WITH COMMENTS_*

Code:
---------
class Program
    {
        static void Main(string[] args)
        {
            int[] ints = new int[5] {1, 4 , 11, 19, 22}; // int array with 5 elements, each element is pre defined.

            string input; //input is the string we type into the console before pressing "enter"
            int inputText; // inputText is an int value that we will put the string representation of an int inside this after we parse it

            input = Console.ReadLine(); // input now equals whatever we put into the console

            inputText = int.Parse(input); // inputText (int) now equals the parsed string (input) as an int32 value

            switch (inputText) // switch can called by anything such as string, boolean, char ect.. in this case, it's an int value (inputText
            {
                case 1: // case 1 is int value of 1, so in the console we type "1" to call this case
                    {
                        for (int i = 0; i < ints.Length; i++) // define i as an int; if i is less-than ints array length; increment i by 1 every pass
                        {
                            Console.WriteLine("for Loop ints array {1}: {0}",ints[i] , i); // write to console every pass with ints array i value followed by i value
                        }
                        break; // break out of the switch..case and run the rest of the code, you can use goto statement here too
                    }
                case 2: // case can also be a string or char or boolean so it could be "case "foreach": but the switch input needs to be set to string
                    {
                        foreach (int i in ints) // for each integar in ints array, there are 5 elements in the array with 5 integars of [1], [4], [11], [19], [22]
                        {
                            Console.WriteLine("foreach Loop ints array: {0}", i); // print the value of i each pass, first pass will be 1, second 4.. ect..
                        }
                        break; // again, break out of switch..case.
                    }
                case 3: 
                    {
                        int i = 0; // define i equals 0
                        do // do the bottom statement
                        {
                            Console.WriteLine("do...while Loop ints array: {0}", ints[i]); // print the value of ints array using the value of i to find the array element
                            i++; // increment (add) by 1
                        } while (i < 5); // do the statement WHILE i is less than 5 (5 elements in the array)
                        break; // :)
                    }

                case 4:
                    {
                        int i = 0; // i equals 0 again, each i in each case is destroyed after each use and only created while in use so you can use int i all you like
                        while (i < 5) // while i is less than 5 do the bottom statement.
                        {
                            Console.WriteLine("while Loop ints array: {0}", ints[i]); // same as do..while (case 3)
                            i++; // increment i by 1 each pass
                        }
                        break;
                    }
            }
            Console.ReadLine(); // finally readline() just so we can see the result of the case we chose so console don't close instantly!
        }
    }
---------
]]></description>
			<content:encoded><![CDATA[<div>I've been learning C# for a while now and I just though this might be helpful to someone that wants to learn about these specific areas of C# although very simple stuff can be hard to understand to someone learning.<br />
<br />
This also demonstrates a int to string work around <br />
<br />
I can do more upon request but if not, I hope this helps someone :).<br />
<br />
<b><u><font size="5">WITHOUT COMMENTS</font></u></b><br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">class Program<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; static void Main(string[] args)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] ints = new int[5] {1, 4 , 11, 19, 22};<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string input;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int inputText;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input = Console.ReadLine();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputText = int.Parse(input);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (inputText)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; ints.Length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;for Loop ints array {1}: {0}&quot;,ints[i] , i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (int i in ints)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;foreach Loop ints array: {0}&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;do...while Loop ints array: {0}&quot;, ints[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } while (i &lt; 5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (i &lt; 5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;while Loop ints array: {0}&quot;, ints[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.ReadLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</code><hr />
</div> <b><u><font size="5">WITH COMMENTS</font></u></b><br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">class Program<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; static void Main(string[] args)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] ints = new int[5] {1, 4 , 11, 19, 22}; // int array with 5 elements, each element is pre defined.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string input; //input is the string we type into the console before pressing &quot;enter&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int inputText; // inputText is an int value that we will put the string representation of an int inside this after we parse it<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input = Console.ReadLine(); // input now equals whatever we put into the console<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputText = int.Parse(input); // inputText (int) now equals the parsed string (input) as an int32 value<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (inputText) // switch can called by anything such as string, boolean, char ect.. in this case, it's an int value (inputText<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1: // case 1 is int value of 1, so in the console we type &quot;1&quot; to call this case<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; ints.Length; i++) // define i as an int; if i is less-than ints array length; increment i by 1 every pass<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;for Loop ints array {1}: {0}&quot;,ints[i] , i); // write to console every pass with ints array i value followed by i value<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; // break out of the switch..case and run the rest of the code, you can use goto statement here too<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2: // case can also be a string or char or boolean so it could be &quot;case &quot;foreach&quot;: but the switch input needs to be set to string<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (int i in ints) // for each integar in ints array, there are 5 elements in the array with 5 integars of [1], [4], [11], [19], [22]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;foreach Loop ints array: {0}&quot;, i); // print the value of i each pass, first pass will be 1, second 4.. ect..<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; // again, break out of switch..case.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 0; // define i equals 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do // do the bottom statement<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;do...while Loop ints array: {0}&quot;, ints[i]); // print the value of ints array using the value of i to find the array element<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++; // increment (add) by 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } while (i &lt; 5); // do the statement WHILE i is less than 5 (5 elements in the array)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; // :)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 0; // i equals 0 again, each i in each case is destroyed after each use and only created while in use so you can use int i all you like<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (i &lt; 5) // while i is less than 5 do the bottom statement.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;while Loop ints array: {0}&quot;, ints[i]); // same as do..while (case 3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++; // increment i by 1 each pass<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.ReadLine(); // finally readline() just so we can see the result of the case we chose so console don't close instantly!<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>C#-Guy</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537083-Tutorial-Switch..Case-Loops-and-1D-Arrays-*Heavily-Commented*</guid>
		</item>
		<item>
			<title>Resizing a RichTextBox</title>
			<link>http://forums.codeguru.com/showthread.php?537035-Resizing-a-RichTextBox&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 09:29:48 GMT</pubDate>
			<description>Hi

I have placed a richtextbox on a form and I would like its size to be the size of the form, so I set the dock property to fill. My problem is that when I added a menubar and a toolbar at the top of the form, the first few lines of the rtb are now hidden. On the other hand if I set the dock property to none, when I resize the form, the rtb size remains fixed. 

Is there a way to make the rtb start exactly under the toolbar but when I resize the form it will be resized accordingly?

Thank you in advance.</description>
			<content:encoded><![CDATA[<div>Hi<br />
<br />
I have placed a richtextbox on a form and I would like its size to be the size of the form, so I set the dock property to fill. My problem is that when I added a menubar and a toolbar at the top of the form, the first few lines of the rtb are now hidden. On the other hand if I set the dock property to none, when I resize the form, the rtb size remains fixed. <br />
<br />
Is there a way to make the rtb start exactly under the toolbar but when I resize the form it will be resized accordingly?<br />
<br />
Thank you in advance.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>belti</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537035-Resizing-a-RichTextBox</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] Process.Start() => speed-- vs. Console]]></title>
			<link>http://forums.codeguru.com/showthread.php?537013-RESOLVED-Process.Start()-gt-speed-vs.-Console&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 18:03:45 GMT</pubDate>
			<description><![CDATA[Hi,

I want to make the process of ffmpeg visible to a progressbar. While caring for it, I mentioned that running ffmpeg via


Code:
---------
 strCmdText = "-y -i \"" + path + "\"";
 strCmdText += " -async 1 -vf yadif -c:v libx264 -b:v 1024k -r 30 -bf 1 -an nul.avi";
 Process.Start(new ProcessStartInfo("lib\\ffmpeg.exe", strCmdText));
---------
is about 2/3 slower than running it in console (app: 130 progress fps, console: 400 progress fps).

I already tried to run the Process.Start in an extra thread.

The CPU usage is 75% while running in console, but 100% while running in the app.
RAM usage is the same.

Is there a way to fix this?]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I want to make the process of ffmpeg visible to a progressbar. While caring for it, I mentioned that running ffmpeg via<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"> strCmdText = &quot;-y -i \&quot;&quot; + path + &quot;\&quot;&quot;;<br />
&nbsp;strCmdText += &quot; -async 1 -vf yadif -c:v libx264 -b:v 1024k -r 30 -bf 1 -an nul.avi&quot;;<br />
&nbsp;Process.Start(new ProcessStartInfo(&quot;lib\\ffmpeg.exe&quot;, strCmdText));</code><hr />
</div> is about 2/3 slower than running it in console (app: 130 progress fps, console: 400 progress fps).<br />
<br />
I already tried to run the Process.Start in an extra thread.<br />
<br />
The CPU usage is 75% while running in console, but 100% while running in the app.<br />
RAM usage is the same.<br />
<br />
Is there a way to fix this?</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>gu471</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537013-RESOLVED-Process.Start()-gt-speed-vs.-Console</guid>
		</item>
		<item>
			<title><![CDATA["No valid exports were found that match the constraint" in Release, but not Debug]]></title>
			<link>http://forums.codeguru.com/showthread.php?536987-quot-No-valid-exports-were-found-that-match-the-constraint-quot-in-Release-but-not-Debug&amp;goto=newpost</link>
			<pubDate>Tue, 14 May 2013 20:16:25 GMT</pubDate>
			<description><![CDATA[Hello all. I am using VS2010 with .NET 4

I have some code that looks in a directory for any dlls and then finds the one that contains the correct exports and reads it in. 

The code is below:


Code:
---------
 
var catalog = new AggregateCatalog();
_container = new CompositionContainer(catalog);
string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string roofcalcPath = Path.Combine(exePath, "roofcalc");
if (Directory.Exists(roofcalcPath))
{
	try
	{
	// where to find the calculator DLL
                    try
                    {
                        catalog.Catalogs.Add(new DirectoryCatalog(roofcalcPath));
                    }
                    catch (ReflectionTypeLoadException rtle)
                    {
                        Type[] err = rtle.Types;

                    }
	// Load calculator DLL, create and store reference to object instances
	// that are marked Import in this class.
	_container.ComposeParts(this);
}
catch (System.ComponentModel.Composition.ChangeRejectedException)
{
	// expected exception of calculator DLL is not present in the directory
					Calculator = null;
}
}
---------
The dll that I'm trying to load implements the proper interface


Code:
---------
    [Export(typeof(IRoofCalc))]
    public class GPiStructHelper : IRoofCalc
    {
         /// <summary>
        /// Call this from iStruct to pass in the structural data and 
        /// return a list of reaction loads to be further processed by iStruct
        /// </summary>
        /// <param name="structureData"></param>
        /// <returns></returns>
        ResultData IRoofCalc.CalculateReactions(StructureData structureData)
        {
            //convert iStruct data to GP data
            GPHelperClass.ImportData(structureData);

            //Design each member
            List<GPRoofMember> rfMembers = new List<GPRoofMember>();
            List<GPColumnBracing> cols = new List<GPColumnBracing>();
            List<GPStrongback> strgbks = new List<GPStrongback>();

            foreach (KeyValuePair<long, GPObject> gpObject in StaticGPiStructHelper.StructuralItems)
            {
                if (gpObject.Value is GPRoofMember)
                {
                    GPRoofMember target = gpObject.Value as GPRoofMember;
                    rfMembers.Add(target);
                }
                if (gpObject.Value is GPStrongback)
                {
                    GPStrongback stbk = gpObject.Value as GPStrongback;
                    if (!stbk.IsWall)
                        strgbks.Add(stbk);
                }
                if (gpObject.Value is GPColumnBracing)
                {
                    GPColumnBracing col = gpObject.Value as GPColumnBracing;
                    if (col.GetOwner() == 0)
                        cols.Add(col);
                }
            }
            foreach(GPRoofMember target in rfMembers)
                if (!target.IsDesigned)
                    target.Design();
  
            //Transfer loads for strongbacks and bracing
            foreach (GPStrongback stbk in strgbks)
            {
                stbk.TransferLoads();
            }
            foreach(GPColumnBracing col in cols)
            {
                col.TransferLoads();
            }
        

            //convert data from GP to iStruct
            return GPHelperClass.ExportData();
        }

        Sample IRoofCalc.CalcWithData(Sample samp)
        {
            return null;
        }
 
        string IRoofCalc.Hello()
        {
            string msg = "Not implemented";
            return msg;
        }

    }
---------
It works perfectly and is able to read the dll and perform the functions when I use the DEBUG version of the dll, however when I use the RELEASE version I get the following error message

The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) No valid exports were found that match the constraint '((exportDefinition.ContractName == "StructuredDesign.RoofCalcInterface.IRoofCalc") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "StructuredDesign.RoofCalcInterface.IRoofCalc".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.

Resulting in: Cannot set import 'GPAddonTestHarness.Host.Calculator (ContractName="StructuredDesign.RoofCalcInterface.IRoofCalc")' on part 'GPAddonTestHarness.Host'.
Element: GPAddonTestHarness.Host.Calculator (ContractName="StructuredDesign.RoofCalcInterface.IRoofCalc") -->  GPAddonTestHarness.Host


Please help me figure out what the heck is going on.]]></description>
			<content:encoded><![CDATA[<div>Hello all. I am using VS2010 with .NET 4<br />
<br />
I have some code that looks in a directory for any dlls and then finds the one that contains the correct exports and reads it in. <br />
<br />
The code is below:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"> <br />
var catalog = new AggregateCatalog();<br />
_container = new CompositionContainer(catalog);<br />
string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);<br />
string roofcalcPath = Path.Combine(exePath, &quot;roofcalc&quot;);<br />
if (Directory.Exists(roofcalcPath))<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // where to find the calculator DLL<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catalog.Catalogs.Add(new DirectoryCatalog(roofcalcPath));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (ReflectionTypeLoadException rtle)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Type[] err = rtle.Types;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Load calculator DLL, create and store reference to object instances<br />
&nbsp; &nbsp; &nbsp; &nbsp; // that are marked Import in this class.<br />
&nbsp; &nbsp; &nbsp; &nbsp; _container.ComposeParts(this);<br />
}<br />
catch (System.ComponentModel.Composition.ChangeRejectedException)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; // expected exception of calculator DLL is not present in the directory<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Calculator = null;<br />
}<br />
}</code><hr />
</div> The dll that I'm trying to load implements the proper interface<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; [Export(typeof(IRoofCalc))]<br />
&nbsp; &nbsp; public class GPiStructHelper : IRoofCalc<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Call this from iStruct to pass in the structural data and <br />
&nbsp; &nbsp; &nbsp; &nbsp; /// return a list of reaction loads to be further processed by iStruct<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;param name=&quot;structureData&quot;&gt;&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;returns&gt;&lt;/returns&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ResultData IRoofCalc.CalculateReactions(StructureData structureData)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //convert iStruct data to GP data<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GPHelperClass.ImportData(structureData);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Design each member<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;GPRoofMember&gt; rfMembers = new List&lt;GPRoofMember&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;GPColumnBracing&gt; cols = new List&lt;GPColumnBracing&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;GPStrongback&gt; strgbks = new List&lt;GPStrongback&gt;();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (KeyValuePair&lt;long, GPObject&gt; gpObject in StaticGPiStructHelper.StructuralItems)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (gpObject.Value is GPRoofMember)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GPRoofMember target = gpObject.Value as GPRoofMember;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rfMembers.Add(target);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (gpObject.Value is GPStrongback)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GPStrongback stbk = gpObject.Value as GPStrongback;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!stbk.IsWall)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strgbks.Add(stbk);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (gpObject.Value is GPColumnBracing)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GPColumnBracing col = gpObject.Value as GPColumnBracing;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (col.GetOwner() == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cols.Add(col);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach(GPRoofMember target in rfMembers)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!target.IsDesigned)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; target.Design();<br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Transfer loads for strongbacks and bracing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (GPStrongback stbk in strgbks)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stbk.TransferLoads();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach(GPColumnBracing col in cols)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; col.TransferLoads();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //convert data from GP to iStruct<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return GPHelperClass.ExportData();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Sample IRoofCalc.CalcWithData(Sample samp)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string IRoofCalc.Hello()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string msg = &quot;Not implemented&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return msg;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; }</code><hr />
</div> It works perfectly and is able to read the dll and perform the functions when I use the DEBUG version of the dll, however when I use the RELEASE version I get the following error message<br />
<br />
The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.<br />
<br />
1) No valid exports were found that match the constraint '((exportDefinition.ContractName == &quot;StructuredDesign.RoofCalcInterface.IRoofCalc&quot;) AndAlso (exportDefinition.Metadata.ContainsKey(&quot;ExportTypeIdentity&quot;) AndAlso &quot;StructuredDesign.RoofCalcInterface.IRoofCalc&quot;.Equals(exportDefinition.Metadata.get_Item(&quot;ExportTypeIdentity&quot;))))', invalid exports may have been rejected.<br />
<br />
Resulting in: Cannot set import 'GPAddonTestHarness.Host.Calculator (ContractName=&quot;StructuredDesign.RoofCalcInterface.IRoofCalc&quot;)' on part 'GPAddonTestHarness.Host'.<br />
Element: GPAddonTestHarness.Host.Calculator (ContractName=&quot;StructuredDesign.RoofCalcInterface.IRoofCalc&quot;) --&gt;  GPAddonTestHarness.Host<br />
<br />
<br />
Please help me figure out what the heck is going on.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>DaMoNarch</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536987-quot-No-valid-exports-were-found-that-match-the-constraint-quot-in-Release-but-not-Debug</guid>
		</item>
		<item>
			<title>Pl Guide ..</title>
			<link>http://forums.codeguru.com/showthread.php?536945-Pl-Guide-..&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 07:08:52 GMT</pubDate>
			<description>I am designing a project where I am reading binary data ( parameters and XY Point Data) from a file and displaying it .

 I have designed it using MDI property and in Open File I open Text View and Graphics View.

 I have also designed the above by declaring two forms and activating them in Open Routine.

PL guide me , what is the difference between two methods and advantages of MDI.

Thanking you</description>
			<content:encoded><![CDATA[<div>I am designing a project where I am reading binary data ( parameters and XY Point Data) from a file and displaying it .<br />
<br />
 I have designed it using MDI property and in Open File I open Text View and Graphics View.<br />
<br />
 I have also designed the above by declaring two forms and activating them in Open Routine.<br />
<br />
PL guide me , what is the difference between two methods and advantages of MDI.<br />
<br />
Thanking you</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>new_2012</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536945-Pl-Guide-..</guid>
		</item>
		<item>
			<title>converting block of jpg to wmv using window media encoder</title>
			<link>http://forums.codeguru.com/showthread.php?536931-converting-block-of-jpg-to-wmv-using-window-media-encoder&amp;goto=newpost</link>
			<pubDate>Sun, 12 May 2013 06:19:42 GMT</pubDate>
			<description><![CDATA[Hi
I try to convert jpg to wmv using window media encoder
SetInput of screenshot works well: SrcVid.SetInput("ScreenCap://ScreenCapture1", "", "");
When I change the SetInput to jpg
I am running this code (contain single jpg for Trial) I get error
"System.Runtime.InteropServices.COMException (0xC00D0BB8): The input media format is invalid."
at line: SrcVid.SetInput(@"C:\Users\jacoba\Videos\Untitled.jpg", "", "");
any idea how to SetInput for jpg (or any others image - BMP, PNG etc.) 
          Thanks,




Code:
---------
try
            {
                //get current folder
                string curentFolder = Directory.GetCurrentDirectory();
                
                // Create a WMEncoder object.
                WMEncoder Encoder = new WMEncoder();

                // Retrieve the source group collection.
                IWMEncSourceGroupCollection SrcGrpColl = Encoder.SourceGroupCollection;

                // Add a source group to the collection.
                IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("SG_1");

                IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                
                //SrcVid.SetInput("ScreenCap://ScreenCapture1", "", "");
                SrcVid.SetInput(@"C:\Users\jacoba\Videos\Untitled.jpg", "", ""); //Bitmap file (.bmp, .gif or .jpg file)



                // Crop 2 pixels from each edge of the video image.
                SrcVid.CroppingBottomMargin = 2;
                SrcVid.CroppingTopMargin = 2;
                SrcVid.CroppingLeftMargin = 2;
                SrcVid.CroppingRightMargin = 2;

                // Specify a file object in which to save encoded content.
                IWMEncFile File = Encoder.File;
                File.LocalFileName = curentFolder + @"\OutputFile.wmv";

                // Choose a profile from the collection.
                IWMEncProfileCollection ProColl = Encoder.ProfileCollection;
                IWMEncProfile Pro;
                for (int i = 0; i < ProColl.Count; i++)
                {
                    Pro = ProColl.Item(i);
                    //Console.WriteLine(Pro.Name.ToString());
                    if (Pro.Name == "Windows Media Video 8 for Broadband (PAL, 700 Kbps)")  //"Screen Video/Audio High (CBR)"
                    {
                        SrcGrp.set_Profile(Pro);
                        break;
                    }
                }

                // Fill in the description object members.
                IWMEncDisplayInfo Descr = Encoder.DisplayInfo;
                Descr.Author = "Author name";
                Descr.Copyright = "Copyright information";
                Descr.Description = "Text description of encoded content";
                Descr.Rating = "Rating information";
                Descr.Title = "Title of encoded content";

                // Start the encoding process.
                // Wait until the encoding process stops before exiting the application.
                Encoder.PrepareToEncode(true);
                Encoder.Start();
                Console.WriteLine("Press Enter when the file has been encoded.");
                Console.ReadLine(); // Press Enter after the file has been encoded.
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.ReadLine();
            }
---------
]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
I try to convert jpg to wmv using window media encoder<br />
SetInput of screenshot works well: SrcVid.SetInput(&quot;ScreenCap://ScreenCapture1&quot;, &quot;&quot;, &quot;&quot;);<br />
When I change the SetInput to jpg<br />
I am running this code (contain single jpg for Trial) I get error<br />
&quot;System.Runtime.InteropServices.COMException (0xC00D0BB8): The input media format is invalid.&quot;<br />
at line: SrcVid.SetInput(@&quot;C:\Users\jacoba\Videos\Untitled.jpg&quot;, &quot;&quot;, &quot;&quot;);<br />
any idea how to SetInput for jpg (or any others image - BMP, PNG etc.) <br />
          Thanks,<br />
<br />
<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //get current folder<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string curentFolder = Directory.GetCurrentDirectory();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a WMEncoder object.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WMEncoder Encoder = new WMEncoder();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Retrieve the source group collection.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IWMEncSourceGroupCollection SrcGrpColl = Encoder.SourceGroupCollection;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Add a source group to the collection.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IWMEncSourceGroup SrcGrp = SrcGrpColl.Add(&quot;SG_1&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //SrcVid.SetInput(&quot;ScreenCap://ScreenCapture1&quot;, &quot;&quot;, &quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SrcVid.SetInput(@&quot;C:\Users\jacoba\Videos\Untitled.jpg&quot;, &quot;&quot;, &quot;&quot;); //Bitmap file (.bmp, .gif or .jpg file)<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Crop 2 pixels from each edge of the video image.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SrcVid.CroppingBottomMargin = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SrcVid.CroppingTopMargin = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SrcVid.CroppingLeftMargin = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SrcVid.CroppingRightMargin = 2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Specify a file object in which to save encoded content.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IWMEncFile File = Encoder.File;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File.LocalFileName = curentFolder + @&quot;\OutputFile.wmv&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Choose a profile from the collection.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IWMEncProfileCollection ProColl = Encoder.ProfileCollection;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IWMEncProfile Pro;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; ProColl.Count; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pro = ProColl.Item(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Console.WriteLine(Pro.Name.ToString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Pro.Name == &quot;Windows Media Video 8 for Broadband (PAL, 700 Kbps)&quot;)&nbsp; //&quot;Screen Video/Audio High (CBR)&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SrcGrp.set_Profile(Pro);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Fill in the description object members.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IWMEncDisplayInfo Descr = Encoder.DisplayInfo;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Descr.Author = &quot;Author name&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Descr.Copyright = &quot;Copyright information&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Descr.Description = &quot;Text description of encoded content&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Descr.Rating = &quot;Rating information&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Descr.Title = &quot;Title of encoded content&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Start the encoding process.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Wait until the encoding process stops before exiting the application.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Encoder.PrepareToEncode(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Encoder.Start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Press Enter when the file has been encoded.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.ReadLine(); // Press Enter after the file has been encoded.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(e.ToString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.ReadLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>jacobah</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536931-converting-block-of-jpg-to-wmv-using-window-media-encoder</guid>
		</item>
		<item>
			<title>c# programatically selecting dropdown value</title>
			<link>http://forums.codeguru.com/showthread.php?536927-c-programatically-selecting-dropdown-value&amp;goto=newpost</link>
			<pubDate>Sat, 11 May 2013 17:23:00 GMT</pubDate>
			<description><![CDATA[I am new at C# and it seems the following code below does not seem to select my combobox value:

Code:
---------
    private void button1_Click(object sender, EventArgs e)
    {
       cbPortNumber.SelectedIndex = 3;
    }
---------
The dropdown looks like this:
Image: http://i.stack.imgur.com/JP7FR.jpg 

All code above does not seem to select HDMI 4 on the list... The error i have is:

*System.ArgumentOutOfRangeException: InvalidArgument=Value of '2' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)*

Any help would be great!

**update showing combobox**
Image: http://i.stack.imgur.com/4dcHs.png 


Code:
---------
        // 
        // cbPortNumber
        // 
        this.cbPortNumber.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append;
        this.cbPortNumber.Enabled = false;
        this.cbPortNumber.FormattingEnabled = true;
        this.cbPortNumber.Location = new System.Drawing.Point(174, 40);
        this.cbPortNumber.Name = "cbPortNumber";
        this.cbPortNumber.Size = new System.Drawing.Size(133, 21);
        this.cbPortNumber.TabIndex = 11;
        this.cbPortNumber.Text = "global_hdmi_port";
        this.helpPortNumber.SetToolTip(this.cbPortNumber, "The HDMI port number, to which you connected your USB-CEC adapter.");
        this.cbPortNumber.SelectedIndexChanged += new System.EventHandler(this.cbPortNumber_SelectedIndexChanged);
---------

Code:
---------
    #region Global settings
    public CECSettingByte HDMIPort
    {
      get
      {
        if (!_settings.ContainsKey(KeyHDMIPort))
        {
          CECSettingByte setting = new CECSettingByte(KeyHDMIPort, "HDMI port", 1, _changedHandler) { LowerLimit = 1, UpperLimit = 15, EnableSetting = EnableHDMIPortSetting };
          setting.Format += delegate(object sender, ListControlConvertEventArgs args)
          {
            ushort tmp;
            if (ushort.TryParse((string)args.Value, out tmp))
              args.Value = "HDMI " + args.Value;
          };

          Load(setting);
          _settings[KeyHDMIPort] = setting;
        }
        return _settings[KeyHDMIPort].AsSettingByte;
      }
    }
---------
And this is what fires the action after selecting something in that dropdown:

Code:
---------
    private void OnSettingChanged(CECSetting setting, object oldValue, object newValue)
    {
      if (setting.KeyName == CECSettings.KeyHDMIPort)
      {
        CECSettingByte byteSetting = setting as CECSettingByte;
        if (byteSetting != null)
        {
          if (!Settings.OverridePhysicalAddress.Value)
            Config.HDMIPort = byteSetting.Value;
          CECActions.SetConnectedDevice(Settings.ConnectedDevice.Value, byteSetting.Value);
        }
      }
---------
]]></description>
			<content:encoded><![CDATA[<div>I am new at C# and it seems the following code below does not seem to select my combobox value:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; private void button1_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp;  cbPortNumber.SelectedIndex = 3;<br />
&nbsp; &nbsp; }</code><hr />
</div> The dropdown looks like this:<br />
<img src="http://i.stack.imgur.com/JP7FR.jpg" border="0" alt="" /><br />
<br />
All code above does not seem to select HDMI 4 on the list... The error i have is:<br />
<br />
<b>System.ArgumentOutOfRangeException: InvalidArgument=Value of '2' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)</b><br />
<br />
Any help would be great!<br />
<br />
**update showing combobox**<br />
<img src="http://i.stack.imgur.com/4dcHs.png" border="0" alt="" /><br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; // cbPortNumber<br />
&nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.Enabled = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.FormattingEnabled = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.Location = new System.Drawing.Point(174, 40);<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.Name = &quot;cbPortNumber&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.Size = new System.Drawing.Size(133, 21);<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.TabIndex = 11;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.Text = &quot;global_hdmi_port&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.helpPortNumber.SetToolTip(this.cbPortNumber, &quot;The HDMI port number, to which you connected your USB-CEC adapter.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.cbPortNumber.SelectedIndexChanged += new System.EventHandler(this.cbPortNumber_SelectedIndexChanged);</code><hr />
</div> <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; #region Global settings<br />
&nbsp; &nbsp; public CECSettingByte HDMIPort<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; get<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!_settings.ContainsKey(KeyHDMIPort))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CECSettingByte setting = new CECSettingByte(KeyHDMIPort, &quot;HDMI port&quot;, 1, _changedHandler) { LowerLimit = 1, UpperLimit = 15, EnableSetting = EnableHDMIPortSetting };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setting.Format += delegate(object sender, ListControlConvertEventArgs args)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ushort tmp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ushort.TryParse((string)args.Value, out tmp))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; args.Value = &quot;HDMI &quot; + args.Value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Load(setting);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _settings[KeyHDMIPort] = setting;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return _settings[KeyHDMIPort].AsSettingByte;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</code><hr />
</div> And this is what fires the action after selecting something in that dropdown:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; private void OnSettingChanged(CECSetting setting, object oldValue, object newValue)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; if (setting.KeyName == CECSettings.KeyHDMIPort)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; CECSettingByte byteSetting = setting as CECSettingByte;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (byteSetting != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!Settings.OverridePhysicalAddress.Value)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Config.HDMIPort = byteSetting.Value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CECActions.SetConnectedDevice(Settings.ConnectedDevice.Value, byteSetting.Value);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; }</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>StealthRT</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536927-c-programatically-selecting-dropdown-value</guid>
		</item>
		<item>
			<title>Access Tool with C#</title>
			<link>http://forums.codeguru.com/showthread.php?536919-Access-Tool-with-C&amp;goto=newpost</link>
			<pubDate>Sat, 11 May 2013 07:25:00 GMT</pubDate>
			<description><![CDATA[Hi everyone,
I'm new to the forums and to c# world, and I'm glad to join you.

The company I work for has an analysis tool which it developed.

This tool is installed on the PC, and part of what this tool does is it interfaces our product, gets logs from it and saves them on the PC.

I'm willing to start off a project, in which I'll access logs, go over them and get relevant information from them / edit them using the Tool's bar, and finally I'll save the new edited log and will print the relevant information on an external Excel file.

Will I be able to access the tool and perform these actions using C#?

Thanks folks! :)]]></description>
			<content:encoded><![CDATA[<div>Hi everyone,<br />
I'm new to the forums and to c# world, and I'm glad to join you.<br />
<br />
The company I work for has an analysis tool which it developed.<br />
<br />
This tool is installed on the PC, and part of what this tool does is it interfaces our product, gets logs from it and saves them on the PC.<br />
<br />
I'm willing to start off a project, in which I'll access logs, go over them and get relevant information from them / edit them using the Tool's bar, and finally I'll save the new edited log and will print the relevant information on an external Excel file.<br />
<br />
Will I be able to access the tool and perform these actions using C#?<br />
<br />
Thanks folks! :)</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>rainm7n</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536919-Access-Tool-with-C</guid>
		</item>
		<item>
			<title>C# with ACCPAC Question</title>
			<link>http://forums.codeguru.com/showthread.php?536915-C-with-ACCPAC-Question&amp;goto=newpost</link>
			<pubDate>Fri, 10 May 2013 15:43:13 GMT</pubDate>
			<description><![CDATA[Hello everyone,

Does anyone have a link or can provide sample code on hooking up to an ACCPAC database?  Even a point in the right direction would be appreciated.  I'm exploring the idea of creating a service in C# or vb that extracts data from a Pervasive SQL Server database used by an accounting appilcation called ACCPAC and sending it to the production MSSQL Server database.]]></description>
			<content:encoded><![CDATA[<div>Hello everyone,<br />
<br />
Does anyone have a link or can provide sample code on hooking up to an ACCPAC database?  Even a point in the right direction would be appreciated.  I'm exploring the idea of creating a service in C# or vb that extracts data from a Pervasive SQL Server database used by an accounting appilcation called ACCPAC and sending it to the production MSSQL Server database.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>viperbyte</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536915-C-with-ACCPAC-Question</guid>
		</item>
		<item>
			<title>Unable to add event handler</title>
			<link>http://forums.codeguru.com/showthread.php?536911-Unable-to-add-event-handler&amp;goto=newpost</link>
			<pubDate>Fri, 10 May 2013 13:52:52 GMT</pubDate>
			<description>Hi all,

see attachment.
in The Main window I can place a button, but I cannot add an event handler....
I Use custom chrome to remove the window borders but keep the resize option.
Also when I uncomment Initialisecomponents() I get a compile error

where do I go wrong.

Regards,

Ger</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
see attachment.<br />
in The Main window I can place a button, but I cannot add an event handler....<br />
I Use custom chrome to remove the window borders but keep the resize option.<br />
Also when I uncomment Initialisecomponents() I get a compile error<br />
<br />
where do I go wrong.<br />
<br />
Regards,<br />
<br />
Ger</div>


	<div style="padding:10px">

	

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Files</legend>
			<ul>
			<li>
	<img class="inlineimg" src="/rar.gif" alt="File Type: rar" />
	<a href="http://forums.codeguru.com/attachment.php?attachmentid=31417&amp;d=1368193950">Shader_Copy1.rar&lrm;</a> 
(176.5 KB)
</li> 
			</ul>
		</fieldset>
	

	</div>
 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>TBBW</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536911-Unable-to-add-event-handler</guid>
		</item>
		<item>
			<title><![CDATA[Creating an iFrame and posting data thro' it]]></title>
			<link>http://forums.codeguru.com/showthread.php?536869-Creating-an-iFrame-and-posting-data-thro-it&amp;goto=newpost</link>
			<pubDate>Wed, 08 May 2013 22:15:12 GMT</pubDate>
			<description><![CDATA["So once you’ve captured the ID, create the iFrame and post the data (eg. &ID=ZXYARE as HTTP POST )through the iFrame to the URL above."

Its a CC processing app that Iam creating to basically check the validity of the customers' CC info. For security reasons, we do not want to capture the data or store it anywhere.

It has to be passed on to the payment processor, Servebase who takes care of encapsulating it and returning just a token. 

From the quote above, I have the ID and know to retrieve and process data via URLs from my C# application. I can have a browser with embedded pages like iFrame in it.

How to post data through an IFrame to any URL?

The tech support guy at Servebase says 
"That data is generated within the iFrame, not by you"

The data refers to the actual CC details - coz the idea is not for my C# app to captire any sensitive CC data, instead letting Servebase do that. He also I need to create the iFrame such as this and it'll automatically take care of encapuslating any sensitive info. Can't understand how this is done.

the iFrame that he showed me in a test page was like this:

Please help. Its greatly appreciated.]]></description>
			<content:encoded><![CDATA[<div>&quot;So once you’ve captured the ID, create the iFrame and post the data (eg. &amp;ID=ZXYARE as HTTP POST )through the iFrame to the URL above.&quot;<br />
<br />
Its a CC processing app that Iam creating to basically check the validity of the customers' CC info. For security reasons, we do not want to capture the data or store it anywhere.<br />
<br />
It has to be passed on to the payment processor, Servebase who takes care of encapsulating it and returning just a token. <br />
<br />
From the quote above, I have the ID and know to retrieve and process data via URLs from my C# application. I can have a browser with embedded pages like iFrame in it.<br />
<br />
How to post data through an IFrame to any URL?<br />
<br />
The tech support guy at Servebase says <br />
&quot;That data is generated within the iFrame, not by you&quot;<br />
<br />
The data refers to the actual CC details - coz the idea is not for my C# app to captire any sensitive CC data, instead letting Servebase do that. He also I need to create the iFrame such as this and it'll automatically take care of encapuslating any sensitive info. Can't understand how this is done.<br />
<br />
the iFrame that he showed me in a test page was like this:<br />
<br />
Please help. Its greatly appreciated.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>CM2013</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536869-Creating-an-iFrame-and-posting-data-thro-it</guid>
		</item>
		<item>
			<title>Where/How to instaniate an object to handle null reference exception C#</title>
			<link>http://forums.codeguru.com/showthread.php?536865-Where-How-to-instaniate-an-object-to-handle-null-reference-exception-C&amp;goto=newpost</link>
			<pubDate>Wed, 08 May 2013 20:47:06 GMT</pubDate>
			<description><![CDATA[Hey guys kind of a simple question, I'm not exactly sure where/how to initialize a new object instance so I don't get this error.  I have a class object(Contact) that has another class object(ContactInfo) and sometimes the user decides not to input(instantiate) the ContactInfo object.  So later when I try to do a search via Contact.ContactInfo, I get the error.  Below I have the line of code where I get the error and then I have the two classes:
foreach (var Contact in Contacts)
            {
                if (String.Equals(Contact._contactInfo.City.ToLower(), city, StringComparison.CurrentCulture))
                {
                    ContactsByCity.Add(Contact);
                }
            }

// and then the two classes:

public class Contact : Person
    {
        private ContactInfo info;
        private ContactInfoLoader loader;
        public ContactInfo _contactInfo { get; set; }
        
        public Contact()
        { }
        public Contact(ContactInfo _info)
        {
            info = _info;           
        }
        public ContactInfo GetContactInfo()
        {
            loader = new ContactInfoLoader(this);
            return loader.GatherContactInfo();
        }     
    }
public class ContactInfo
    {
        public string PhoneNumber { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string State { get; set;}

        public ContactInfo()
        { }

    }]]></description>
			<content:encoded><![CDATA[<div>Hey guys kind of a simple question, I'm not exactly sure where/how to initialize a new object instance so I don't get this error.  I have a class object(Contact) that has another class object(ContactInfo) and sometimes the user decides not to input(instantiate) the ContactInfo object.  So later when I try to do a search via Contact.ContactInfo, I get the error.  Below I have the line of code where I get the error and then I have the two classes:<br />
foreach (var Contact in Contacts)<br />
            {<br />
                if (String.Equals(Contact._contactInfo.City.ToLower(), city, StringComparison.CurrentCulture))<br />
                {<br />
                    ContactsByCity.Add(Contact);<br />
                }<br />
            }<br />
<br />
// and then the two classes:<br />
<br />
public class Contact : Person<br />
    {<br />
        private ContactInfo info;<br />
        private ContactInfoLoader loader;<br />
        public ContactInfo _contactInfo { get; set; }<br />
        <br />
        public Contact()<br />
        { }<br />
        public Contact(ContactInfo _info)<br />
        {<br />
            info = _info;           <br />
        }<br />
        public ContactInfo GetContactInfo()<br />
        {<br />
            loader = new ContactInfoLoader(this);<br />
            return loader.GatherContactInfo();<br />
        }     <br />
    }<br />
public class ContactInfo<br />
    {<br />
        public string PhoneNumber { get; set; }<br />
        public string Address { get; set; }<br />
        public string City { get; set; }<br />
        public string State { get; set;}<br />
<br />
        public ContactInfo()<br />
        { }<br />
<br />
    }</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>jkenny82</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536865-Where-How-to-instaniate-an-object-to-handle-null-reference-exception-C</guid>
		</item>
		<item>
			<title>login form code help usig ms access database</title>
			<link>http://forums.codeguru.com/showthread.php?536859-login-form-code-help-usig-ms-access-database&amp;goto=newpost</link>
			<pubDate>Wed, 08 May 2013 17:57:52 GMT</pubDate>
			<description><![CDATA[hi i am new to c# and wondering if you could help me solve the problem to my login function for my website thanks 


Code:
---------
 protected void btnlogin_Click(object sender, EventArgs e)
        {
            OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=CWsystem.mdb");
          //  OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["CWsystem.mdb"].ConnectionString);
            con.Open();
            string cmdStr="select count(*) from Person where UserID='" + txtusername.Text + "'";
            OleDbCommand Checkuser=new OleDbCommand(cmdStr, con);
            int temp = Convert.ToInt32(Checkuser.ExecuteScalar().ToString());
            if(temp== 1)
            {
                    string cmdStr2="Select Password from Person where username='" + txtusername.Text + "'";
                OleDbCommand pass=new OleDbCommand(cmdStr2, con);
                string password=pass.ExecuteScalar().ToString();
                con.Close();

                if(password == txtpassword.Text)
                {
                    Session["New"] = txtusername.Text;
                    Response.Redirect("university.aspx");
                }
                else
                {
                    Label1.Visible = true;
                    Label1.Text = "invalid password";
                }
            }
                else
                {
                    Label1.Visible = true;
                    Label1.Text = "invalid password";
                }

            }

        protected void txtpassword_TextChanged(object sender, EventArgs e)
        {

        }
        }
    }
---------
]]></description>
			<content:encoded><![CDATA[<div>hi i am new to c# and wondering if you could help me solve the problem to my login function for my website thanks <br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"> protected void btnlogin_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OleDbConnection con = new OleDbConnection(&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=CWsystem.mdb&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings[&quot;CWsystem.mdb&quot;].ConnectionString);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con.Open();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string cmdStr=&quot;select count(*) from Person where UserID='&quot; + txtusername.Text + &quot;'&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OleDbCommand Checkuser=new OleDbCommand(cmdStr, con);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int temp = Convert.ToInt32(Checkuser.ExecuteScalar().ToString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(temp== 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string cmdStr2=&quot;Select Password from Person where username='&quot; + txtusername.Text + &quot;'&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OleDbCommand pass=new OleDbCommand(cmdStr2, con);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string password=pass.ExecuteScalar().ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con.Close();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(password == txtpassword.Text)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Session[&quot;New&quot;] = txtusername.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Response.Redirect(&quot;university.aspx&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label1.Visible = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label1.Text = &quot;invalid password&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label1.Visible = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label1.Text = &quot;invalid password&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected void txtpassword_TextChanged(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>dekon</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536859-login-form-code-help-usig-ms-access-database</guid>
		</item>
		<item>
			<title>Class Vs Structure  in program design ..</title>
			<link>http://forums.codeguru.com/showthread.php?536839-Class-Vs-Structure-in-program-design-..&amp;goto=newpost</link>
			<pubDate>Wed, 08 May 2013 05:48:21 GMT</pubDate>
			<description>I am converting my old C project to c# project to explore the language.
 
 My C program is a viewer , which reads a file and displays Data and parameters in different formats and print them .

 I have used plenty of structures in my c code.

 Now should I convert them to classes and use ? 

 or 

 I should define a class and use structures inside ?

pl guide ..

Thanking you ..</description>
			<content:encoded><![CDATA[<div>I am converting my old C project to c# project to explore the language.<br />
 <br />
 My C program is a viewer , which reads a file and displays Data and parameters in different formats and print them .<br />
<br />
 I have used plenty of structures in my c code.<br />
<br />
 Now should I convert them to classes and use ? <br />
<br />
 or <br />
<br />
 I should define a class and use structures inside ?<br />
<br />
pl guide ..<br />
<br />
Thanking you ..</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>new_2012</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536839-Class-Vs-Structure-in-program-design-..</guid>
		</item>
		<item>
			<title>Need help in coding the below requirement using C#.net..(Attach a file to new mail wi</title>
			<link>http://forums.codeguru.com/showthread.php?536813-Need-help-in-coding-the-below-requirement-using-C-.net..(Attach-a-file-to-new-mail-wi&amp;goto=newpost</link>
			<pubDate>Tue, 07 May 2013 06:53:49 GMT</pubDate>
			<description><![CDATA[I need to open a new mail window in microsoft outlook and attach a file from C;\...\... drive. I am using "Process.Start("mailto:" + EmailAddress + "?subject=" + Subject + "&body=" + Body + "&attach=" +CSVfilePath);" code to do this job, but the code does not attach the file...

Note: I need the new mail window open and I need to leave the choice to the user whether to click on Send button or not?...can someone please help............Thanks]]></description>
			<content:encoded><![CDATA[<div>I need to open a new mail window in microsoft outlook and attach a file from C;\...\... drive. I am using &quot;Process.Start(&quot;mailto:&quot; + EmailAddress + &quot;?subject=&quot; + Subject + &quot;&amp;body=&quot; + Body + &quot;&amp;attach=&quot; +CSVfilePath);&quot; code to do this job, but the code does not attach the file...<br />
<br />
Note: I need the new mail window open and I need to leave the choice to the user whether to click on Send button or not?...can someone please help............Thanks</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?11-C-Sharp-Programming">C-Sharp Programming</category>
			<dc:creator>prabhakar.itta</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536813-Need-help-in-coding-the-below-requirement-using-C-.net..(Attach-a-file-to-new-mail-wi</guid>
		</item>
	</channel>
</rss>
