<?xml version="1.0" encoding="utf-8"?>

<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>DaniWeb IT Discussion Community - C#</title>
		<link>http://www.daniweb.com/forums/</link>
		<description><![CDATA[Our C# forum is the place for Q&A-style discussions related to the programming language known as Microsoft's response to java. Note that we also have an ASP.NET forum within the Web Development category.]]></description>
		<language>en-US</language>
		<lastBuildDate>Sun, 29 Nov 2009 13:53:55 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - C#</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>C++ newbie question about joining 2D grid with struct data</title>
			<link>http://www.daniweb.com/forums/thread242179.html</link>
			<pubDate>Sun, 29 Nov 2009 12:08:10 GMT</pubDate>
			<description>Hello everyone: 
 
I am a C++ newbie; I am interesting in using C++ in my work on coupled fluid flow-chemical reaction problems.  I apologize in advance for what is probably a very simple question.  I would very much appreciate some help to get me on the right track! 
 
My goal is to come up with...</description>
			<content:encoded><![CDATA[<div>Hello everyone:<br />
<br />
I am a C++ newbie; I am interesting in using C++ in my work on coupled fluid flow-chemical reaction problems.  I apologize in advance for what is probably a very simple question.  I would very much appreciate some help to get me on the right track!<br />
<br />
My goal is to come up with C++ code for solving a finite difference problem.  To do this, I need to (1) construct a 2-D grid and (2) link a struct of data (fluid properties) to the grid.  At some point, as I become more experienced, I'd like to learn how to use pointers and iterators, etc, but for now I would like to keep things as simple as possible.  <br />
<br />
Using some examples, I have come up with a way of constructing a grid that mostly makes sense.  But I cannot figure out how to link the grid with a struct of fluid properties.  Sorry--I'm certain this is a simple thing to do.<br />
<br />
Here is my grid:<br />
<br />
template &lt;typename T&gt;				<br />
class Grid2D<br />
{<br />
  public:<br />
	Grid() : xsize_(0), ysize_(0), grid_(0) { }		<br />
	Grid(double xsize, double ysize) : xsize_(xsize), ysize_(ysize), grid_(new T[ xsize_ * ysize_ ]) { }<br />
								<br />
	~Grid() { delete[ ] grid_; }			<br />
	Create(double xsize, double ysize) 		<br />
		{<br />
		xsize_ = xsize; 				<br />
		ysize_ = ysize;<br />
		grid_ = new T[ xsize_ * ysize_ ];		<br />
		}<br />
	Resize(double xsize, double ysize) <br />
		{<br />
		xsize_ = xsize; 				<br />
		ysize_ = ysize; <br />
		delete[ ] grid_;					<br />
		grid_ = new T[ xsize_ * ysize_ ];<br />
		}<br />
	Delete()						<br />
		{<br />
		xsize_ = 0;<br />
		ysize_ = 0;<br />
		delete[ ] grid_;<br />
		grid_ = 0;<br />
		}<br />
	double xsize() const { return xsize_; }	<br />
	double ysize() const { return ysize_; }		<br />
	T&amp; operator(double x, double y) { return grid_[ y*xsize_ + x ]; }			<br />
	const T&amp; operator(double x, double y) const { return grid_[ y*xsize_ + x ]; }		<br />
  private: <br />
	double xsize_, ysize_;<br />
	T* grid_;<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Annettest</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242179.html</guid>
		</item>
		<item>
			<title>Treeview source code</title>
			<link>http://www.daniweb.com/forums/thread242141.html</link>
			<pubDate>Sun, 29 Nov 2009 07:05:59 GMT</pubDate>
			<description>Hello 
 
How i can find the source code of Treeview of c# .Net? 
tnx</description>
			<content:encoded><![CDATA[<div>Hello<br />
<br />
How i can find the source code of Treeview of c# .Net?<br />
tnx</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>fazeleh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242141.html</guid>
		</item>
		<item>
			<title>Entity Framework woes</title>
			<link>http://www.daniweb.com/forums/thread242089.html</link>
			<pubDate>Sat, 28 Nov 2009 21:56:24 GMT</pubDate>
			<description><![CDATA[Hi all 
 
I'm new to the Entity Framework and trying to get my head around it but struggling somewhat.   
 
I'm trying to do something basic like the below but it bombs out with a 'Null reference exception - Object reference not set to an instance of an object." when I try and do...]]></description>
			<content:encoded><![CDATA[<div>Hi all<br />
<br />
I'm new to the Entity Framework and trying to get my head around it but struggling somewhat.  <br />
<br />
I'm trying to do something basic like the below but it bombs out with a 'Null reference exception - Object reference not set to an instance of an object.&quot; when I try and do em.AddToCompanies(c); I'm just not able to debug it to get a decent error. I have manually checked there are no non-nullable fields that need filling in. tried catching an exception but I just get the same.  <br />
<br />
Can anyone tell me how I debug the Entity framework?  I have tried on VS2008 and vs2010 with zero luck.<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Company c = new Company();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.Code = &quot;MyCode&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.FullName = &quot;test co&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.IsActive = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.Language = &quot;ENG&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; em.AddToCompanies(c);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; em.SaveChanges();</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>tig2810</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242089.html</guid>
		</item>
		<item>
			<title>hi</title>
			<link>http://www.daniweb.com/forums/thread242070.html</link>
			<pubDate>Sat, 28 Nov 2009 19:06:44 GMT</pubDate>
			<description><![CDATA[hi all iam new in this forum and i need some help in my assignment .. it's a c# game using graphics .. this game when start it should show a sheep then a chicken randomly then all graphics will move to the left .. there will be a dora girl which moving up and down ,, if she catch a sheep the score...]]></description>
			<content:encoded><![CDATA[<div>hi all iam new in this forum and i need some help in my assignment .. it's a c# game using graphics .. this game when start it should show a sheep then a chicken randomly then all graphics will move to the left .. there will be a dora girl which moving up and down ,, if she catch a sheep the score will increase by 10 else the score will decreas by 10 and the all over time is 90 sec .. any idea how i should start ??</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>student88</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242070.html</guid>
		</item>
		<item>
			<title>Replace text in text/config file.</title>
			<link>http://www.daniweb.com/forums/thread242026.html</link>
			<pubDate>Sat, 28 Nov 2009 14:41:21 GMT</pubDate>
			<description>Nvm, figured it out by myself.</description>
			<content:encoded><![CDATA[<div>Nvm, figured it out by myself.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Jaydenn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242026.html</guid>
		</item>
		<item>
			<title>HttpUtility.UrlPathEncode</title>
			<link>http://www.daniweb.com/forums/thread241993.html</link>
			<pubDate>Sat, 28 Nov 2009 10:28:42 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I am "googling" for the whole morning, but I am not able to find an HttpUtility.UrlPathEncode in C# Compact Framework - simply, I need to encode/decode URL and post data for my windows mobile application making a web request. Please, do you know, how to do it? 
 
M.]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am &quot;googling&quot; for the whole morning, but I am not able to find an HttpUtility.UrlPathEncode in C# Compact Framework - simply, I need to encode/decode URL and post data for my windows mobile application making a web request. Please, do you know, how to do it?<br />
<br />
M.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>mstrop</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241993.html</guid>
		</item>
		<item>
			<title><![CDATA[I don't understand why it doens't update my Access Database...]]></title>
			<link>http://www.daniweb.com/forums/thread241981.html</link>
			<pubDate>Sat, 28 Nov 2009 08:47:36 GMT</pubDate>
			<description><![CDATA[Hi everyone,  
   
  I don't understand why this doesn't update my actual MS Access 2003 mdb file. During debug phase, I learned that it updates the dataset and creates new rows. But it doesn't reflect into the database. Why is it so? Please help me out. Thanks in advance.  <div class="codeblock">...]]></description>
			<content:encoded><![CDATA[<div>Hi everyone, <br />
  <br />
  I don't understand why this doesn't update my actual MS Access 2003 mdb file. During debug phase, I learned that it updates the dataset and creates new rows. But it doesn't reflect into the database. Why is it so? Please help me out. Thanks in advance. <pre style="margin:20px; line-height:13px">else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Auto generate item code&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtIcode.Text = this.GenerateCode(ItemDS.Item, &quot;ITM-&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a new row.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CSOAIS.BACKEND.DATASETS.ItemDataset.ItemRow NewItemRow;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow = ItemDS.Item.NewItemRow();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.ItemCode = this.GenerateCode(ItemDS.Item, &quot;ITM-&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.ItemName = this.txtIname.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.ItemDesc = this.txtIdesc.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.CategoryCode = (string)this.cmboCategory.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.SubCategoryCode = (string)this.cmboSubCat.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.UnitMeasureCode = (string)this.cmboUM.Text;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //set default values<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.LocationCode = &quot;CSO&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NewItemRow.StatusCode = &quot;Active&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Add the row to the Item table<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ItemDS.Item.Rows.Add(NewItemRow);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Save the new row to the database<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.itemTableAdapter.Update(ItemDS.Item);<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>fdsaasdf</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241981.html</guid>
		</item>
		<item>
			<title>Electronic Dictionary issue</title>
			<link>http://www.daniweb.com/forums/thread241962.html</link>
			<pubDate>Sat, 28 Nov 2009 07:17:16 GMT</pubDate>
			<description><![CDATA[*I made an Electronic Dictionary for a college project and it's around 85-90% done. The two final issues I'm having is to figure out how to get a count on each individual word ( there are over 1000 words ), keep track of each of them, and display them ( this ill just throw in a message box with the...]]></description>
			<content:encoded><![CDATA[<div><span style="font-weight:bold">I made an Electronic Dictionary for a college project and it's around 85-90% done. The two final issues I'm having is to figure out how to get a count on each individual word ( there are over 1000 words ), keep track of each of them, and display them ( this ill just throw in a message box with the definition of the word at the end that's no problem ). Obviously I'm using an array to search for the words which are in a text file in the debug folder etc. Just can't rap my head around the counting and more so the tracking of each time a word that has been successfully searched for.</span><br />
<span style="color:Red">Second problem, definitely a dumb question, but for the life of me I figure it out. I have to make it able to add a word/def, modify a word/def, and obviously search for a word/def and i have that setup and working fine.  The problem comes when I try to do any of those three things twice, I can only do one of those once, and after that everything else locks up.</span><br />
<span style="color:Green">Bonus question - Port the program to a PDA or cell phone? I'm told that's possible, if you know how I'll love you long time but it's of zero concern compared to the first two questions I can't figure out.<br />
~Thanks y'all i tried to be as detailed as i can, the project is freaking massive so I can't really put any specific code in here yet. :)</span></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>redstrykr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241962.html</guid>
		</item>
		<item>
			<title>SQL query</title>
			<link>http://www.daniweb.com/forums/thread241959.html</link>
			<pubDate>Sat, 28 Nov 2009 07:06:22 GMT</pubDate>
			<description>In my database I have a field date and eventname.I want to retieive eventnames after the current date.How can I do it?</description>
			<content:encoded><![CDATA[<div>In my database I have a field date and eventname.I want to retieive eventnames after the current date.How can I do it?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Lakshith</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241959.html</guid>
		</item>
		<item>
			<title>Xml Loading</title>
			<link>http://www.daniweb.com/forums/thread241891.html</link>
			<pubDate>Fri, 27 Nov 2009 22:24:11 GMT</pubDate>
			<description><![CDATA[Hi everyone.  I've got this code that I've been following along with a sample.  However, whenever I debug it, I get the error 'XML Exception was unhandled: Root element is missing.'  Here's the code I have so far. 
 
 
namespace SpiveyPropertyRental 
{ 
    public partial class Tenants : Form 
   ...]]></description>
			<content:encoded><![CDATA[<div>Hi everyone.  I've got this code that I've been following along with a sample.  However, whenever I debug it, I get the error 'XML Exception was unhandled: Root element is missing.'  Here's the code I have so far.<br />
<br />
 <pre style="margin:20px; line-height:13px">namespace SpiveyPropertyRental<br />
{<br />
&nbsp; &nbsp; public partial class Tenants : Form<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Tenants()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void ShowTenants()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string strFileName = @&quot;C:\Spivey Property Rental\tenants.xml&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XmlDocument docTenants = new XmlDocument();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (File.Exists(strFileName))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvwTenants.Items.Clear();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; docTenants.Load(strFileName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XmlElement elmTenant = docTenants.DocumentElement;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XmlNodeList lstTenants = elmTenant.ChildNodes;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (XmlNode node in lstTenants)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListViewItem lviTenant = new ListViewItem(node.FirstChild.InnerText); //Account #<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lviTenant.SubItems.Add(node.FirstChild.NextSibling.InnerText); //Full Name<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lviTenant.SubItems.Add(node.FirstChild.NextSibling.NextSibling.InnerText);&nbsp; //Phone #<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lviTenant.SubItems.Add(node.FirstChild.NextSibling.NextSibling.NextSibling.InnerText);&nbsp; //Marital Status<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvwTenants.Items.Add(lviTenant);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void Tenants_Load(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShowTenants();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre><br />
I'm getting the exception here-<br />
 <pre style="margin:20px; line-height:13px">docTenants.Load(strFileName);</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>papanyquiL</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241891.html</guid>
		</item>
		<item>
			<title>flickering problem when using scrollbar in panel</title>
			<link>http://www.daniweb.com/forums/thread241872.html</link>
			<pubDate>Fri, 27 Nov 2009 20:01:18 GMT</pubDate>
			<description>hi 
i used a scrollbar in my panel. but when i scrollup or down the panel flickered.</description>
			<content:encoded><![CDATA[<div>hi<br />
i used a scrollbar in my panel. but when i scrollup or down the panel flickered.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>plastic</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241872.html</guid>
		</item>
		<item>
			<title><![CDATA[Arrays with multiple pictures [C# visual studio windows xp/vista]]]></title>
			<link>http://www.daniweb.com/forums/thread241854.html</link>
			<pubDate>Fri, 27 Nov 2009 18:27:55 GMT</pubDate>
			<description>Hi I have A full program which I have written from google and other reference sourcesand have now came to a bit am stuck at I have created two new classes and this scrolls through the items information when I click the next button but I cannot get it to display each of the items different pictures...</description>
			<content:encoded><![CDATA[<div>Hi I have A full program which I have written from google and other reference sourcesand have now came to a bit am stuck at I have created two new classes and this scrolls through the items information when I click the next button but I cannot get it to display each of the items different pictures when I click next if anyone is able to email me I will send them my project to see if they understand where I am going wrong thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>andrewglasgow</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241854.html</guid>
		</item>
		<item>
			<title>Please help with Crystal Report Viewer</title>
			<link>http://www.daniweb.com/forums/thread241853.html</link>
			<pubDate>Fri, 27 Nov 2009 18:26:34 GMT</pubDate>
			<description><![CDATA[Hi, i'm learning to use the CrystalReportViewer. 
 
From my application, if i click sort, the data in the viewer will be sort due to ProductName, so i try to use the SortFields, but everytime i try to call something like SortFields[0], i always get an error saying "bad index" 
 
Please have a look...]]></description>
			<content:encoded><![CDATA[<div>Hi, i'm learning to use the CrystalReportViewer.<br />
<br />
From my application, if i click sort, the data in the viewer will be sort due to ProductName, so i try to use the SortFields, but everytime i try to call something like SortFields[0], i always get an error saying &quot;bad index&quot;<br />
<br />
Please have a look at my code and help me, thanks a lot, the problem is in Click event of btnSort<br />
<br />
<a rel="nofollow" class="t" href="http://dl.dropbox.com/u/1089304/Assignment13.rar" target="_blank">http://dl.dropbox.com/u/1089304/Assignment13.rar</a></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>kalodakilla</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241853.html</guid>
		</item>
		<item>
			<title>Get image from database</title>
			<link>http://www.daniweb.com/forums/thread241852.html</link>
			<pubDate>Fri, 27 Nov 2009 18:16:33 GMT</pubDate>
			<description><![CDATA[i have a c# project with a table "Pics". it has two columns R_no(int) Picto(OLE). How i can store images if different formats in this table and retrieve it  to show in a picture box. plz help me to solve this 
my code is as below 
 
string q2 = "select picto from pics where R_no="...]]></description>
			<content:encoded><![CDATA[<div>i have a c# project with a table &quot;Pics&quot;. it has two columns R_no(int) Picto(OLE). How i can store images if different formats in this table and retrieve it  to show in a picture box. plz help me to solve this<br />
my code is as below<br />
 <pre style="margin:20px; line-height:13px">string q2 = &quot;select picto from pics where R_no=&quot; +Convert.ToInt16(cmb_rno.SelectedItem) + &quot;&quot;;<br />
pictureBox1.Image = obj.toreader(q2);<br />
public Image toreader(string qury)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Image img=null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OleDbCommand cmd = new OleDbCommand(qury, mycon);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mycon.Open();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OleDbDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (rdr.Read())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;READ SUCCESFULLY&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte&#91;&#93; b = (byte&#91;&#93;)rdr.GetValue(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; img = new Bitmap(new MemoryStream(b, true));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mycon.Close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return img;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mycon.Close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;Eror While reading by reader\n&quot;+ex.Message);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return img;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
it gives error like this &quot;parameter is not valid&quot;</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>ejazmusavi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241852.html</guid>
		</item>
		<item>
			<title>How many weekdays between 2 dates</title>
			<link>http://www.daniweb.com/forums/thread241796.html</link>
			<pubDate>Fri, 27 Nov 2009 13:33:11 GMT</pubDate>
			<description>If I have two dates like this, I wonder how it will be possible to count how many of these days that are: 
Monday,Tuesday,Wednesday,Thursday,Friday 
 
The dates are for example: 
 
11/01/2009 
11/18/2009</description>
			<content:encoded><![CDATA[<div>If I have two dates like this, I wonder how it will be possible to count how many of these days that are:<br />
Monday,Tuesday,Wednesday,Thursday,Friday<br />
<br />
The dates are for example:<br />
<br />
11/01/2009<br />
11/18/2009</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Darth Vader</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241796.html</guid>
		</item>
		<item>
			<title>Folder`s name in User`s start menu</title>
			<link>http://www.daniweb.com/forums/thread241793.html</link>
			<pubDate>Fri, 27 Nov 2009 12:56:53 GMT</pubDate>
			<description>I did an application, published and installed it. In my User`s Start Menu there is created a new folder with y shortcut to my application.exe inside. 
What`s bothering me is the name if this folder. It has a name, that I don`t know how and where to change it. 
I was looking all over visual studio...</description>
			<content:encoded><![CDATA[<div>I did an application, published and installed it. In my User`s Start Menu there is created a new folder with y shortcut to my application.exe inside.<br />
What`s bothering me is the name if this folder. It has a name, that I don`t know how and where to change it.<br />
I was looking all over visual studio and in the assemblyInfo class, but there is no such name.<br />
The folder name is &quot;www.skywalker.si&quot; :<br />
P<a rel="nofollow" class="t" href="http://www.file.si/files/ph8r1e09apjbq12grknj.jpg" target="_blank">ICTURE of my User`s start menu</a></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241793.html</guid>
		</item>
		<item>
			<title>center detection</title>
			<link>http://www.daniweb.com/forums/thread241781.html</link>
			<pubDate>Fri, 27 Nov 2009 11:26:02 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I have a problem. I have this image with various regions detected and coloured differntly. What I now need to do is, to find the mathematical center of each of these regions. 
 
I have the code for this.  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I have a problem. I have this image with various regions detected and coloured differntly. What I now need to do is, to find the mathematical center of each of these regions.<br />
<br />
I have the code for this. <br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int labelnew = 2,centerx,centery;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;Point&gt; l = new List&lt;Point&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Point p1 = new Point();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Point p2 = new Point();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (labelnew &lt; label)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (i = 1; i &lt; bd.Height; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (j = 1; j &lt; bd.Width; j++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (I[j, i] == labelnew)<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; l.Add(p1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l.Sort();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p1 = l.ElementAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p2 = l.ElementAt(l.Count - 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; centerx = (p1.X + p2.X) / 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; centery = (p1.Y + p2.Y) / 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b.SetPixel(centerx, centery, Color.Red);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l.Clear();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++labelnew;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>label contains the value for each region, starting from 2 and not 0. When I run the code, I get the following error :<br />
<span style="font-weight:bold">Failed to compare two elements in the array</span><br />
Can someone help me out n tell me what my mistake is</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sathya8819</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241781.html</guid>
		</item>
		<item>
			<title>C# Interop.Excel issue or dumb user?</title>
			<link>http://www.daniweb.com/forums/thread241754.html</link>
			<pubDate>Fri, 27 Nov 2009 08:35:35 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I have an app that use an excel component(ocxt.com). This component have a strange behavior, which I reproduced it with Interop.Excel. 
 
Bellow is the functions with I open and close an excel file programatically: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have an app that use an excel component(ocxt.com). This component have a strange behavior, which I reproduced it with Interop.Excel.<br />
<br />
Bellow is the functions with I open and close an excel file programatically:<br />
<br />
 <pre style="margin:20px; line-height:13px">private ApplicationClass app = null;<br />
private Workbook book = null;<br />
private Worksheet sheet = null;<br />
<br />
...<br />
<br />
private void openExcel(string fileName)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (app != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; closeExcel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; app = new ApplicationClass();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; app.Visible = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; app.ScreenUpdating = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; app.DisplayAlerts = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; book = app.Workbooks.Open(fileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);<br />
&nbsp; &nbsp; &nbsp; &nbsp; sheet = (Worksheet)book.Sheets[1];<br />
}<br />
<br />
void closeExcel()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (sheet != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Runtime.InteropServices.Marshal.ReleaseComObject(sheet);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sheet = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (book != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book.Close(false, Missing.Value, Missing.Value);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Runtime.InteropServices.Marshal.ReleaseComObject(book);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (app != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; app.Quit();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Runtime.InteropServices.Marshal.ReleaseComObject(app);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; app = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; GC.Collect();<br />
}</pre>If I have 2 files: 1.xls and 2.xls and 1.xls I always open with .net code, and 2.xls double clicking it. There is 2 undesired (for me) behaviors:<br />
<br />
1. If I open first by code file 1.xls, and then try to open 2.xls from Windows Explorer, 2.xls doesn't open. It only open an inactive Excel.<br />
2. When I close by code 1.xls, it close 2.xls too.<br />
<br />
What I do wrong?<br />
Thank you.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>crispusx</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241754.html</guid>
		</item>
		<item>
			<title>Access remote server mysql database server using windows forms client application</title>
			<link>http://www.daniweb.com/forums/thread241726.html</link>
			<pubDate>Fri, 27 Nov 2009 04:37:42 GMT</pubDate>
			<description>I have been developing a MySQL database backup and restore appliation in windows forms. This application crates a dump of a mysql database at remote location and imports everything from the dump file back into local mysql database. 
 
MySQL database is located at the server which hosts my php...</description>
			<content:encoded><![CDATA[<div>I have been developing a MySQL database backup and restore appliation in windows forms. This application crates a dump of a mysql database at remote location and imports everything from the dump file back into local mysql database.<br />
<br />
MySQL database is located at the server which hosts my php website. So it is obvious that if i want to access that mysql server from my local network, i have to allow mysqlserver at remote location to allow me to connect from my company's local network, by adding the public ip of my network in the lists of ip that remote mysqlserver  can allow connections from. I set this thing in CPanel.<br />
<br />
It's working fine.<br />
<br />
But my question is that, i have anathor software called let's say mysqlyog, that can connect to remote mysqlserver without allowing my local networks ip in the cpanel of remote server.<br />
<br />
So i mean to say that if mysqlyog can do that, why my application can't do that the same way msqlyog does.<br />
<br />
What kind of mechanism do they apply?<br />
i just don't know how to do this in windows forms and C#.<br />
<br />
how do they bypass the firewalls and or just connect to remote mysqlserver.<br />
<br />
What is the trick?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>nccsbim071</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241726.html</guid>
		</item>
		<item>
			<title>Difference in minutes between 2 Dates</title>
			<link>http://www.daniweb.com/forums/thread241710.html</link>
			<pubDate>Fri, 27 Nov 2009 02:37:45 GMT</pubDate>
			<description>I am looking for how it is possible to calculate the difference in minutes for a date and time. 
 
This example will cover the problem. 
 
*20091118 18:15 
20091125 01:35* 
 
I know this is possible using Date functions and TimeSpan but trying to find examples but cant find an example of this...</description>
			<content:encoded><![CDATA[<div>I am looking for how it is possible to calculate the difference in minutes for a date and time.<br />
<br />
This example will cover the problem.<br />
<br />
<span style="font-weight:bold">20091118 18:15<br />
20091125 01:35</span><br />
<br />
I know this is possible using Date functions and TimeSpan but trying to find examples but cant find an example of this problem.<br />
<br />
I will be happy to solve this.<br />
<br />
Thank you!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Darth Vader</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241710.html</guid>
		</item>
		<item>
			<title>SQL Database</title>
			<link>http://www.daniweb.com/forums/thread241700.html</link>
			<pubDate>Fri, 27 Nov 2009 01:30:33 GMT</pubDate>
			<description>If I build an application using BS 2008 in C# that uses an SQL database, Do I have to include SQL Express as part of the deployment package?  In other words, does the user need SQL Express on his/her machine in order to use my application if my app does all the work?</description>
			<content:encoded><![CDATA[<div>If I build an application using BS 2008 in C# that uses an SQL database, Do I have to include SQL Express as part of the deployment package?  In other words, does the user need SQL Express on his/her machine in order to use my application if my app does all the work?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>christian73</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241700.html</guid>
		</item>
		<item>
			<title>Hello word I need help with button click</title>
			<link>http://www.daniweb.com/forums/thread241668.html</link>
			<pubDate>Thu, 26 Nov 2009 21:54:38 GMT</pubDate>
			<description>i am making a program need 128 button 
when u click on button  color of button change to red 
when you click it a gain it back to normal color 
is there a way to code one button and the other take the same function 
thank at all</description>
			<content:encoded><![CDATA[<div>i am making a program need 128 button<br />
when u click on button  color of button change to red<br />
when you click it a gain it back to normal color<br />
is there a way to code one button and the other take the same function<br />
thank at all</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Fire_Michel</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241668.html</guid>
		</item>
		<item>
			<title>Help cant save data to sql database in c#</title>
			<link>http://www.daniweb.com/forums/thread241645.html</link>
			<pubDate>Thu, 26 Nov 2009 19:41:36 GMT</pubDate>
			<description><![CDATA[<div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div> <strong>C# Syntax</strong> (<a...]]></description>
			<content:encoded><![CDATA[<div> <pre style="margin:20px; line-height:13px">using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace CarsRUS<br />
{<br />
&nbsp; &nbsp; public partial class Cars : Form<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; private SqlConnection conn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private SqlDataAdapter daAddresses;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private DataSet dsAddresses;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private DataGrid dgAddresses;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private const string tableName = &quot;CarRUS&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public class Customer<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public Customer(string CustomerID, string Forename, string Surname, string Address, string PostCode)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.customerID = CustomerID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.forename = Forename;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.surname = Surname;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.address = Address;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.postcode = PostCode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public string customerID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public string forename;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public string surname;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public string address;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public string postcode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //button for new customer<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void button1_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Customer c = new Customer(textBox1.Text, textBox2.Text, textBox5.Text, textBox6.Text, textBox9.Text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; customerQueue.Enqueue(c);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fillListBox(customerQueue);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox1.Text = &quot;&quot;;//text box 1 will show the value that the user types in the customer id text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox2.Text = &quot;&quot;;//text box 2 will show the value that the user types in the forename text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox5.Text = &quot;&quot;;//text box 5 will show the value that the user types in the surname text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox6.Text = &quot;&quot;;//text box 6 will show the value that the user types in the address text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox9.Text = &quot;&quot;;//text box 9 will show the value that the user types in the postcode text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox10.Text = &quot;&quot;;//text box 10 will show the value that the user types in the telno text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void fillListBox(Queue&lt;Customer&gt; customers)//fill the listbox of the customer details<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IEnumerator&lt;Customer&gt; myEnumerator = customerQueue.GetEnumerator();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listBox1.Items.Add(&quot;----Start of Customer Booking----&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //display the message above to show the start of the queue<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (myEnumerator.MoveNext())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listBox1.Items.Add(myEnumerator.Current.customerID + &quot; &quot; + myEnumerator.Current.forename + &quot; &quot; + myEnumerator.Current.surname + &quot; &quot; + myEnumerator.Current.address + &quot; &quot; + myEnumerator.Current.postcode);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }//list the details of the customer by customer id and then forename followed by the surname and then the address and then the postcode<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void Cars_Load(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Button to quit program<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void button3_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; Queue&lt;Customer&gt; customerQueue = new Queue&lt;Customer&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Cars()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // fill dataset<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Initdata();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // set up datagrid<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dgAddresses = new DataGrid();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dgAddresses.Location = new Point(5, 5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dgAddresses.Size = new Size(500, 500);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dgAddresses.DataSource = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dgAddresses.DataMember = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // create update button<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Button btnUpdate = new Button();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btnUpdate.Text = &quot;Update&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btnUpdate.Location = new Point(600, 150);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btnUpdate.Click += new EventHandler(btnUpdateClicked);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // make sure controls appear on form<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Controls.AddRange(new Control[] { dgAddresses, btnUpdate });<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; // set up ADO.NET objects<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void Initdata()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  conn = new SqlConnection(<br />
&quot;Data Source=.\\SQLEXPRESS;AttachDbFilename=G:\\CarRUS.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (System.Exception ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;Exception&quot; + ex.ToString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 1. instantiate a new DataSet<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dsAddresses = new DataSet();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 2. init SqlDataAdapter with select command and connection<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; daAddresses = new SqlDataAdapter(&quot;select CustomerID, Forename, Surname, Address, PostCod, TelNo from CarRUS&quot;, conn);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 3. fill in insert, update, and delete commands<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SqlCommandBuilder cmdBldr = new SqlCommandBuilder(daAddresses);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 4. fill the dataset<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //daAddresses.Fill(dsAddresses, tableName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Update button was clicked<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void btnUpdateClicked(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // write changes back to DataBase<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; daAddresses.Update(dsAddresses, tableName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void button2_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void GridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}//end</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>wiselka</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241645.html</guid>
		</item>
		<item>
			<title>progressbar timing</title>
			<link>http://www.daniweb.com/forums/thread241640.html</link>
			<pubDate>Thu, 26 Nov 2009 19:33:50 GMT</pubDate>
			<description>Hi  
I have a data logger that records different lenghts of data. I download it in my application and create graphs. 
I need to show a progressbar to indicate how long the download is going to take. I get data from the logger to indicate how long the data run was. I have timed it and it takes about...</description>
			<content:encoded><![CDATA[<div>Hi <br />
I have a data logger that records different lenghts of data. I download it in my application and create graphs.<br />
I need to show a progressbar to indicate how long the download is going to take. I get data from the logger to indicate how long the data run was. I have timed it and it takes about 1second to download 1.68 minutes of data.<br />
If the logger run was 44minutes, it takes 26 seconds to download.<br />
<br />
when I set my progressBar.Max = 100 and timer,Interval = 260 milliseconds, the progressBar finishes in about 6 second instead of 26 seconds. <br />
What am I doing wrong?<br />
<br />
 <pre style="margin:20px; line-height:13px"> private void progressTimer(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subData1 = startValues1.Split(new char[] { ' ' });<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double progressTime = Convert.ToDouble(subData1[13]);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int tValue = Convert.ToInt16(progressTime /1.68);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer1.Interval = tValue;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Increment the value of the ProgressBar a value of one each time.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; progressBar1.Increment(1);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Determine if we have completed by comparing the value of the Value property to the Maximum value.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (progressBar1.Value == progressBar1.Maximum)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Stop the timer.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer1.Stop();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>procomp65</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241640.html</guid>
		</item>
		<item>
			<title>Need help ASAP!</title>
			<link>http://www.daniweb.com/forums/thread241612.html</link>
			<pubDate>Thu, 26 Nov 2009 15:26:44 GMT</pubDate>
			<description><![CDATA[Hey I need some help to get a asignment done for tomorrow! 
 
I need to create a hex to decimal converter.  
 
EASY right! 
 
Well here is the catch. I can't use visual studios libraries to create is so [ 
string sHex = S; 
                int iNumber = int.Parse(sHex,...]]></description>
			<content:encoded><![CDATA[<div>Hey I need some help to get a asignment done for tomorrow!<br />
<br />
I need to create a hex to decimal converter. <br />
<br />
EASY right!<br />
<br />
Well here is the catch. I can't use visual studios libraries to create is so [<br />
string sHex = S;<br />
                int iNumber = int.Parse(sHex, System.Globalization.NumberStyles.HexNumber);<br />
                string sInt = iNumber.ToString();<br />
] <br />
<br />
is out of the question. I need to create it from scratch.<br />
<br />
even more It shall handle hex numbers with the value aspect from decimal 127 to -128 or 7f to -80 in hex.<br />
<br />
<br />
PLZ give me some advices!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>XshulderX</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241612.html</guid>
		</item>
		<item>
			<title>watershed image segmentation</title>
			<link>http://www.daniweb.com/forums/thread241552.html</link>
			<pubDate>Thu, 26 Nov 2009 11:14:19 GMT</pubDate>
			<description><![CDATA[Hi,   
 
I have this following code for watershed algo to segment an image. But I do not know what the error is. Can someone help me out 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi,  <br />
<br />
I have this following code for watershed algo to segment an image. But I do not know what the error is. Can someone help me out<br />
<br />
 <pre style="margin:20px; line-height:13px">namespace watershed1<br />
{<br />
&nbsp; &nbsp; public partial class Form1 : Form<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int Y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int Height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // labels the pixel as belonging to a unique basin or as a part of the watershed line<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int Label;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Distance is a work image of distances<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int Distance;<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Form1()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.X = -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Y = -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Height = -1000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Label = -1000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Distance = -1000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Form1(int x, int y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.X = x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Y = y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Height = -1000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Label = WatershedCommon.INIT;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Distance = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Form1(int x, int y, int height)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.X = x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Y = y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Height = height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Label = WatershedCommon.INIT;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Distance = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public override bool Equals(Object obj)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Form1 p = (Form1)obj;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (X == p.X &amp;&amp; X == p.Y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public override int GetHashCode()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public override string ToString()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &quot;Height = &quot; + Height + &quot;; X = &quot; + X.ToString() + &quot;, Y = &quot; + Y.ToString() +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;; Label = &quot; + Label.ToString() + &quot;; Distance = &quot; + Distance.ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void Form1_Load(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void button1_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OpenFileDialog o = new OpenFileDialog();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o.InitialDirectory = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o.RestoreDirectory = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (o.ShowDialog() == DialogResult.OK)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.pictureBox1.Image = new Bitmap(o.FileName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.pictureBox1.Height = this.pictureBox1.Image.Height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.pictureBox1.Width = this.pictureBox1.Image.Width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pictureBox1.Visible = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Invalidate();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.pictureBox2.Height = this.pictureBox1.Image.Height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.pictureBox2.Width = this.pictureBox1.Image.Width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pictureBox2.Visible = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Invalidate();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void button2_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bitmap bmp = (Bitmap)pictureBox1.Image;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WatershedGrayscale wg = new WatershedGrayscale(8);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitmapData bmpdata = bmp.LockBits(rect, ImageLockMode.ReadWrite, bmp.PixelFormat);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wg.execute(bmpdata);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bmp.UnlockBits(bmpdata);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pictureBox2.Image = (System.Drawing.Image)bmp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pictureBox1.Visible = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public class WatershedGrayscale : FilterGrayToGray<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; #region Variables<br />
&nbsp; &nbsp; &nbsp; &nbsp; private Form1 FictitiousPixel = new Form1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int _currentLabel = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int _currentDistance = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private FifoQueue _fifoQueue = new FifoQueue();<br />
&nbsp; &nbsp; &nbsp; &nbsp; // each pixel can be accesesd from 2 places: a dictionary for faster direct lookup of neighbouring pixels <br />
&nbsp; &nbsp; &nbsp; &nbsp; // or from a height ordered list<br />
&nbsp; &nbsp; &nbsp; &nbsp; // sorted array of pixels according to height<br />
&nbsp; &nbsp; &nbsp; &nbsp; private List&lt;List&lt;Form1&gt;&gt; _heightSortedList;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // string in the form &quot;X,Y&quot; is used as a key for the dictionary lookup of a pixel<br />
&nbsp; &nbsp; &nbsp; &nbsp; private Dictionary&lt;string, Form1&gt; _pixelMap;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int _watershedPixelCount = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int _numberOfNeighbours = 8;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private bool _borderInWhite;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int _pictureWidth = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int _pictureHeight = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; #endregion<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; #region Constructors<br />
&nbsp; &nbsp; &nbsp; &nbsp; public WatershedGrayscale()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : this(8)<br />
&nbsp; &nbsp; &nbsp; &nbsp; { }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public WatershedGrayscale(int numberOfNeighbours)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (numberOfNeighbours != 8 &amp;&amp; numberOfNeighbours != 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new Exception(&quot;Invalid number of neighbour pixels to check. Valid values are 4 and 8.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _borderInWhite = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _numberOfNeighbours = numberOfNeighbours;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _heightSortedList = new List&lt;List&lt;Form1&gt;&gt;(256);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; 256; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _heightSortedList.Add(new List&lt;Form1&gt;());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; #endregion<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; #region Properties<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// number of neighbours to check for each pixel. valid values are 8 and 4<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int NumberOfNeighbours<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get { return _numberOfNeighbours; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (value != 8 &amp;&amp; value != 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new Exception(&quot;Invalid number of neighbour pixels to check. Valid values are 4 and 8.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _numberOfNeighbours = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Number of labels/basins found<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int LabelCount<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get { return _currentLabel; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set { _currentLabel = value; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// True: border is drawn in white. False: border is drawn in black<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;value&gt;&lt;/value&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public bool BorderInWhite<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get { return _borderInWhite; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set { _borderInWhite = value; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; #endregion<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void CreatePixelMapAndHeightSortedArray(BitmapData data)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _pictureWidth = data.Width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _pictureHeight = data.Height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // pixel map holds every pixel thus size of (_pictureWidth * _pictureHeight)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _pixelMap = new Dictionary&lt;string, Form1&gt;(_pictureWidth * _pictureHeight);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsafe<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int offset = data.Stride - data.Width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* ptr = (byte*)(data.Scan0);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // get histogram of all values in grey = height<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int y = 0; y &lt; data.Height; y++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int x = 0; x &lt; data.Width; x++, ptr++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Form1 p = new Form1(x, y, *ptr);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // add every pixel to the pixel map<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _pixelMap.Add(p.X.ToString() + &quot;,&quot; + p.Y.ToString(), p);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _heightSortedList[*ptr].Add(p);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ptr += offset;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this._currentLabel = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void Segment()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Geodesic SKIZ (skeleton by influence zones) of each level height<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int h = 0; h &lt; _heightSortedList.Count; h++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // get all pixels for current height<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (Form1 heightSortedPixel in _heightSortedList[h])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; heightSortedPixel.Label = WatershedCommon.MASK;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // for each pixel on current height get neighbouring pixels<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;Form1&gt; neighbouringPixels = GetNeighbouringPixels(heightSortedPixel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // initialize queue with neighbours at level h of current basins or watersheds<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (Form1 neighbouringPixel in neighbouringPixels)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (neighbouringPixel.Label &gt; 0 || neighbouringPixel.Label == WatershedCommon.WSHED)<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; heightSortedPixel.Distance = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _fifoQueue.AddToEnd(heightSortedPixel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentDistance = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _fifoQueue.AddToEnd(FictitiousPixel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // extend basins<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Form1 p = _fifoQueue.RemoveAtFront();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (p.Equals(FictitiousPixel))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (_fifoQueue.IsEmpty)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<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; _fifoQueue.AddToEnd(FictitiousPixel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentDistance++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p = _fifoQueue.RemoveAtFront();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;Form1&gt; neighbouringPixels = GetNeighbouringPixels(p);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // labelling p by inspecting neighbours<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (Form1 neighbouringPixel in neighbouringPixels)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // neighbouringPixel belongs to an existing basin or to watersheds<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // in the original algorithm the condition is:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp;  if (neighbouringPixel.Distance &lt; currentDistance &amp;&amp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; (neighbouringPixel.Label &gt; 0 || neighbouringPixel.Label == WatershedCommon.WSHED))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp;  but this returns incomplete borders so the this one is used&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; if (neighbouringPixel.Distance &lt;= _currentDistance &amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  (neighbouringPixel.Label &gt; 0 || neighbouringPixel.Label == WatershedCommon.WSHED))<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; if (neighbouringPixel.Label &gt; 0)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; // the commented condition is also in the original algorithm <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // but it also gives incomplete borders<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (p.Label == WatershedCommon.MASK /*|| p.Label == WatershedCommon.WSHED*/)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Label = neighbouringPixel.Label;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (p.Label != neighbouringPixel.Label)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; p.Label = WatershedCommon.WSHED;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _watershedPixelCount++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (p.Label == WatershedCommon.MASK)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; p.Label = WatershedCommon.WSHED;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _watershedPixelCount++;<br />
&nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // neighbouringPixel is plateau pixel<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (neighbouringPixel.Label == WatershedCommon.MASK &amp;&amp; neighbouringPixel.Distance == 0)<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; neighbouringPixel.Distance = _currentDistance + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _fifoQueue.AddToEnd(neighbouringPixel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // detect and process new minima at height level h<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (Form1 p in _heightSortedList[h])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // reset distance to zero<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Distance = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // if true then p is inside a new minimum <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (p.Label == WatershedCommon.MASK)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // create new label<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentLabel++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Label = _currentLabel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _fifoQueue.AddToEnd(p);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (!_fifoQueue.IsEmpty)<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; Form1 q = _fifoQueue.RemoveAtFront();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // check neighbours of q<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;Form1&gt; neighbouringPixels = GetNeighbouringPixels(q);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (Form1 neighbouringPixel in neighbouringPixels)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; if (neighbouringPixel.Label == WatershedCommon.MASK)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; neighbouringPixel.Label = _currentLabel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _fifoQueue.AddToEnd(neighbouringPixel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private List&lt;Form1&gt; GetNeighbouringPixels(Form1 centerPixel)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;Form1&gt; temp = new List&lt;Form1&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (_numberOfNeighbours == 8)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CP = Center pixel<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (X,Y) -- get all 8 connected <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |-1,-1|0,-1|1,-1|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |-1, 0| CP |1, 0|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |-1,+1|0,+1|1,+1|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // -1, -1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X - 1) &gt;= 0 &amp;&amp; (centerPixel.Y - 1) &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X - 1).ToString() + &quot;,&quot; + (centerPixel.Y - 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 0, -1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.Y - 1) &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[centerPixel.X.ToString() + &quot;,&quot; + (centerPixel.Y - 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 1, -1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X + 1) &lt; _pictureWidth &amp;&amp; (centerPixel.Y - 1) &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X + 1).ToString() + &quot;,&quot; + (centerPixel.Y - 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // -1, 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X - 1) &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X - 1).ToString() + &quot;,&quot; + centerPixel.Y.ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 1, 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X + 1) &lt; _pictureWidth)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X + 1).ToString() + &quot;,&quot; + centerPixel.Y.ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // -1, 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X - 1) &gt;= 0 &amp;&amp; (centerPixel.Y + 1) &lt; _pictureHeight)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X - 1).ToString() + &quot;,&quot; + (centerPixel.Y + 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 0, 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.Y + 1) &lt; _pictureHeight)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[centerPixel.X.ToString() + &quot;,&quot; + (centerPixel.Y + 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 1, 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X + 1) &lt; _pictureWidth &amp;&amp; (centerPixel.Y + 1) &lt; _pictureHeight)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X + 1).ToString() + &quot;,&quot; + (centerPixel.Y + 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CP = Center pixel, N/A = not used<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (X,Y) -- get only 4 connected <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | N/A |0,-1| N/A |<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |-1, 0| CP |+1, 0|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | N/A |0,+1| N/A |<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; -1, 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X - 1) &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X - 1).ToString() + &quot;,&quot; + centerPixel.Y.ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 0, -1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.Y - 1) &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[centerPixel.X.ToString() + &quot;,&quot; + (centerPixel.Y - 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 1, 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.X + 1) &lt; _pictureWidth)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[(centerPixel.X + 1).ToString() + &quot;,&quot; + centerPixel.Y.ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; 0, 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((centerPixel.Y + 1) &lt; _pictureHeight)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.Add(_pixelMap[centerPixel.X.ToString() + &quot;,&quot; + (centerPixel.Y + 1).ToString()]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void DrawWatershedLines(BitmapData data)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (_watershedPixelCount == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte watershedColor = 255;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!_borderInWhite)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; watershedColor = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsafe<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int offset = data.Stride - data.Width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* ptr = (byte*)(data.Scan0);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int y = 0; y &lt; data.Height; y++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int x = 0; x &lt; data.Width; x++, ptr++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // if the pixel in our map is watershed pixel then draw it<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (_pixelMap[x.ToString() + &quot;,&quot; + y.ToString()].Label == WatershedCommon.WSHED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *ptr = watershedColor;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ptr += offset;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected override void ProcessFilter(BitmapData imageData)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CreatePixelMapAndHeightSortedArray(imageData);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Segment();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DrawWatershedLines(imageData);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void execute(BitmapData imageData)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProcessFilter(imageData);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public class FifoQueue<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; List&lt;Form1&gt; queue = new List&lt;Form1&gt;();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int Count<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get { return queue.Count; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void AddToEnd(Form1 p)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; queue.Add(p);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Form1 RemoveAtFront()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Form1 temp = queue[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; queue.RemoveAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public bool IsEmpty<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get { return (queue.Count == 0); }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public override string ToString()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return base.ToString() + &quot; Count = &quot; + queue.Count.ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public class WatershedCommon<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; #region Constants<br />
&nbsp; &nbsp; &nbsp; &nbsp; public const int INIT = -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public const int MASK = -2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public const int WSHED = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; #endregion<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sathya8819</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241552.html</guid>
		</item>
		<item>
			<title>call function in childform from mdi parent</title>
			<link>http://www.daniweb.com/forums/thread241541.html</link>
			<pubDate>Thu, 26 Nov 2009 10:29:34 GMT</pubDate>
			<description>hi 
i have function in mdiparent form and i want to use it in child form.  
i created an object reference of parent form in child form and tried to call the function but this didnt worked. 
wat should i do??</description>
			<content:encoded><![CDATA[<div>hi<br />
i have function in mdiparent form and i want to use it in child form. <br />
i created an object reference of parent form in child form and tried to call the function but this didnt worked.<br />
wat should i do??</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>plastic</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241541.html</guid>
		</item>
		<item>
			<title>Code Snippet Event Handler Tutorial</title>
			<link>http://www.daniweb.com/code/snippet241539.html</link>
			<pubDate>Thu, 26 Nov 2009 10:23:03 GMT</pubDate>
			<description>How to Handle Events 
 
Event handlers make up a large portion of Windows Form Coding. 
There have been a lot of questions on the C# forum of late that stemmed from people creating Event Handlers incorrectly. 
 
First lets look at how an event and its event handler works: 
Each event is a piece of...</description>
			<content:encoded><![CDATA[<div>How to Handle Events<br />
<br />
Event handlers make up a large portion of Windows Form Coding.<br />
There have been a lot of questions on the C# forum of late that stemmed from people creating Event Handlers incorrectly.<br />
<br />
First lets look at how an event and its event handler works:<br />
Each event is a piece of application-level information. The .net framework interprets lower level input and creates the events event. These events are processed by the frameworks event dispatcher which is responsible for the relationship between event and handler.<br />
<br />
In order for the event dispatcher to call the correct event handler the event handler must be bound to the event.<br />
This can be done several ways:<br />
<br />
1) Using the Visual Studio Designer (see events.jpg)<br />
<br />
Click on the control who's event you wish to handle.<br />
Click on the lightning bolt at the top of the properties window to view available events.<br />
Double click the empty box next to the event to create an empty event handler in your Form code and add the event handlers binding to the Form.designer.cs file.<br />
<br />
<br />
2) Manually Bind event handler (see code snippet below)<br />
<br />
In your code, after the control has been created (usually InitializeComponent() in the FormLoad), you can manually bind an event handler to an event using  <pre style="margin:20px; line-height:13px">button1.Click+=new EventHandler(button1_Click);</pre>This will inform the event dispatcher that when the Click event is raised on button1, the method button1_Click() should be called.<br />
If you create your event handlers manually you must ensure that the method has the correct parameters to match the event handlers signature; for a buttons click event the parameters look like  <pre style="margin:20px; line-height:13px"> private void button1_Click(object sender, EventArgs e)</pre>.</div>  <br /> <div style="padding:5px">    <fieldset class="fieldset"> <legend>Attached Images</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/jpg.gif" alt="File Type: jpg" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12724&amp;d=1259230918" target="_blank">events.jpg</a> (183.2 KB)</td> </tr> </table> </fieldset>   </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Ryshad</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241539.html</guid>
		</item>
		<item>
			<title>Error after app`s installation</title>
			<link>http://www.daniweb.com/forums/thread241532.html</link>
			<pubDate>Thu, 26 Nov 2009 09:56:09 GMT</pubDate>
			<description>I have done and published application and this is what I got just after the installation: 
 
What can be wrong? 
 
PLATFORM VERSION INFO 
 Windows  : 5.1.2600.196608 (Win32NT) 
 Common Language Runtime  : 2.0.50727.3603 
 System.Deployment.dll  : 2.0.50727.3053 (netfxsp.050727-3000) 
 mscorwks.dll ...</description>
			<content:encoded><![CDATA[<div>I have done and published application and this is what I got just after the installation:<br />
<br />
What can be wrong?<br />
<br />
PLATFORM VERSION INFO<br />
 Windows  : 5.1.2600.196608 (Win32NT)<br />
 Common Language Runtime  : 2.0.50727.3603<br />
 System.Deployment.dll  : 2.0.50727.3053 (netfxsp.050727-3000)<br />
 mscorwks.dll  : 2.0.50727.3603 (GDR.050727-3600)<br />
 dfdll.dll  : 2.0.50727.3053 (netfxsp.050727-3000)<br />
 dfshim.dll  : 2.0.50727.3053 (netfxsp.050727-3000)<br />
<br />
SOURCES<br />
 Deployment url : file:///C:/1/AvtoKrka.application<br />
 Application url : file:///C:/1/Application%20Files/AvtoKrka_0_0_0_66/AvtoKrka.exe.manifest<br />
<br />
IDENTITIES<br />
 Deployment Identity : AvtoKrka.application, Version=0.0.0.66, Culture=neutral, PublicKeyToken=c8a67d17a3a72edc, processorArchitecture=msil<br />
 Application Identity : AvtoKrka.exe, Version=0.0.0.66, Culture=neutral, PublicKeyToken=c8a67d17a3a72edc, processorArchitecture=msil, type=win32<br />
<br />
APPLICATION SUMMARY<br />
 * Installable application.<br />
<br />
ERROR SUMMARY<br />
 Below is a summary of the errors, details of these errors are listed later in the log.<br />
 * Activation of C:\1\AvtoKrka.application resulted in exception. Following failure messages were detected:<br />
 + Value does not fall within the expected range.<br />
<br />
COMPONENT STORE TRANSACTION FAILURE SUMMARY<br />
 No transaction error was detected.<br />
<br />
WARNINGS<br />
 There were no warnings during this operation.<br />
<br />
OPERATION PROGRESS STATUS<br />
 * [26.11.2009 9:29:54] : Activation of C:\1\AvtoKrka.application has started.<br />
 * [26.11.2009 9:29:55] : Processing of deployment manifest has successfully completed.<br />
 * [26.11.2009 9:29:55] : Installation of the application has started.<br />
 * [26.11.2009 9:29:55] : Processing of application manifest has successfully completed.<br />
 * [26.11.2009 9:29:59] : Request of trust and detection of platform is complete.<br />
 * [26.11.2009 9:30:00] : Downloading of subscription dependencies is complete.<br />
 * [26.11.2009 9:30:00] : Commit of the downloaded application has started.<br />
 * [26.11.2009 9:30:01] : Installation of application has successfully completed.<br />
<br />
ERROR DETAILS<br />
 Following errors were detected during this operation.<br />
 * [26.11.2009 9:30:01] System.ArgumentException<br />
 - Value does not fall within the expected range.<br />
 - Source: System.Deployment<br />
 - Stack trace:<br />
 at System.Deployment.Application.NativeMethods.CorLaunchApplication(UInt32 hostType, String applicationFullName, Int32 manifestPathsCount, String[] manifestPaths, Int32 activationDataCount, String[] activationData, PROCESS_INFORMATION processInformation)<br />
 at System.Deployment.Application.ComponentStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)<br />
 at System.Deployment.Application.SubscriptionStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)<br />
 at System.Deployment.Application.ApplicationActivator.Activate(DefinitionAppId appId, AssemblyManifest appManifest, String activationParameter, Boolean useActivationParameter)<br />
 at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String&amp; errorPageUrl)<br />
 at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)<br />
<br />
COMPONENT STORE TRANSACTION DETAILS<br />
 * Transaction at [26.11.2009 9:30:01]<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponent<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - Manifest: NBBZC29C.AXY.application<br />
 + System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata<br />
 - Status: Set<br />
 - HRESULT: 0x0<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponent<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - Manifest: AvtoKrka.exe.manifest<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: AvtoKrka.ico<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: AvtoKrka.mdf<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: AvtoKrka.exe.config<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: AvtoKrka_big.ico<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: AvtoKrka_log.ldf<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponent<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - Manifest: office.dll.genman<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: office.dll<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponent<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - Manifest: AvtoKrka.exe.genman<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: AvtoKrka.exe<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponent<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - Manifest: Microsoft.Vbe.Interop.dll.genman<br />
 + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - File: Microsoft.Vbe.Interop.dll<br />
 + System.Deployment.Internal.Isolation.StoreOperationInstallDeployment<br />
 - Status: Installed<br />
 - HRESULT: 0x0<br />
 - AppId: file:///C:/1/AvtoKrka.application#AvtoKrka.application, Version=0.0.0.66, Culture=neutral, PublicKeyToken=c8a67d17a3a72edc, processorArchitecture=msil<br />
 + System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata<br />
 - Status: Set<br />
 - HRESULT: 0x0<br />
 + System.Deployment.Internal.Isolation.StoreTransactionOperationType (27)<br />
 - HRESULT: 0x0</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241532.html</guid>
		</item>
		<item>
			<title>Printing in Windows forms</title>
			<link>http://www.daniweb.com/forums/thread241530.html</link>
			<pubDate>Thu, 26 Nov 2009 09:53:30 GMT</pubDate>
			<description><![CDATA[Hi 
I have a windows application that prints a record in a given page size. 
 
I looked all over but i could not see how did it set the page size. 
 and now requirement is to print the paper size in legal paper size of 18.5" by 14". 
 
How can i set the printing process to print in this paper size....]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
I have a windows application that prints a record in a given page size.<br />
<br />
I looked all over but i could not see how did it set the page size.<br />
 and now requirement is to print the paper size in legal paper size of 18.5&quot; by 14&quot;.<br />
<br />
How can i set the printing process to print in this paper size.<br />
<br />
I have not done this kind of job before so i am finding it quite difficult.<br />
Searching internet was not much help<br />
<br />
Please help</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>nccsbim071</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241530.html</guid>
		</item>
		<item>
			<title>how to read aggregate data from database</title>
			<link>http://www.daniweb.com/forums/thread241521.html</link>
			<pubDate>Thu, 26 Nov 2009 09:24:28 GMT</pubDate>
			<description><![CDATA[Hi, 
 
What is the best way of reading multiple aggregate data ? 
like so; 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
What is the best way of reading multiple aggregate data ?<br />
like so;<br />
 <pre style="margin:20px; line-height:13px"><br />
select&nbsp; id,sum(data1),sum(data2),sum(data3) from table1 group by id</pre>I know with ExecuteScalar you can get one aggregate data, but what about if you have more than one. I tried ExecuteReader and I'm getting exception<br />
 <pre style="margin:20px; line-height:13px">sSqlCommand = &quot;select sum(ssk_matrah),sum(g_ssk_matrah )&nbsp; from per017_ssk&nbsp; where id= '&quot; + dfSicilNo.Text + &quot;' &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +&quot; and puantaj_donem='&quot; + dfDonem.Text + &quot; ' and puantaj_ay=&quot;+ dfAy.Text+&quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OleDbDataReader oku4 = _reader.executar_re(sSqlCommand);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (oku4.Read())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nSSKMatrahi = oku4.GetDouble(0); <span style="color:Green">//here I get exception</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gmatrah = oku4.GetDouble(1);</pre><br />
thanks in advance<br />
snky</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>snakay</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241521.html</guid>
		</item>
		<item>
			<title>make your application look like widget or gadget or sth similar</title>
			<link>http://www.daniweb.com/forums/thread241480.html</link>
			<pubDate>Thu, 26 Nov 2009 06:32:08 GMT</pubDate>
			<description><![CDATA[Hello every one.. 
I want to do the following with my form: 
when application is installed , it has no icon on desktop 
(it doesn't appear) 
instead when you pass the mouse at the edge of your screen 
a small icon will appear .. by clicking on it the application would appear in the middle of the...]]></description>
			<content:encoded><![CDATA[<div>Hello every one..<br />
I want to do the following with my form:<br />
when application is installed , it has no icon on desktop<br />
(it doesn't appear)<br />
instead when you pass the mouse at the edge of your screen<br />
a small icon will appear .. by clicking on it the application would appear in the middle of the screen .. by closing the form it would disappear again..(like web camera application installed on our laptops if u can imagine)<br />
<br />
i know this is related to controlling sizes and locations<br />
but i tried to make the size so small and location as wanted <br />
but for the size , to make it so small i had to set FormBorderStyle<br />
property yo None .. (and i need it to be FixedSingle)<br />
<br />
and it doesn't look good to be professional <br />
I thought i may find a more suitable way to do it<br />
<br />
Any ideas ..?<br />
Thanks in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>dima shawahneh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241480.html</guid>
		</item>
		<item>
			<title>child mdi is not clearly visible</title>
			<link>http://www.daniweb.com/forums/thread241473.html</link>
			<pubDate>Thu, 26 Nov 2009 06:14:43 GMT</pubDate>
			<description>hi 
in my project i build a parent mdi which contains some labels, text and buttons and also a child mdi. when i run the program initially everything is okkk. but on opening the child mdi , the labels,buttons and text of parent mdi, are also visible on the child mdi. i used the enabled and visible...</description>
			<content:encoded><![CDATA[<div>hi<br />
in my project i build a parent mdi which contains some labels, text and buttons and also a child mdi. when i run the program initially everything is okkk. but on opening the child mdi , the labels,buttons and text of parent mdi, are also visible on the child mdi. i used the enabled and visible in parent mdi but that close the whole program. <br />
any sugestion plzzzz</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>plastic</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241473.html</guid>
		</item>
		<item>
			<title>Need some help translating Lisp into C#</title>
			<link>http://www.daniweb.com/forums/thread241444.html</link>
			<pubDate>Thu, 26 Nov 2009 04:23:52 GMT</pubDate>
			<description><![CDATA[Hello all, 
 
I am in the process of translating a program from lisp into C#, most of it has gone smoothly but I have run across two blocks of code that are giving me a bit of trouble. If anyone can help me translate these two pieces of code into C# I'd be very grateful. 
 
The COUNT-HIGHEST...]]></description>
			<content:encoded><![CDATA[<div>Hello all,<br />
<br />
I am in the process of translating a program from lisp into C#, most of it has gone smoothly but I have run across two blocks of code that are giving me a bit of trouble. If anyone can help me translate these two pieces of code into C# I'd be very grateful.<br />
<br />
The COUNT-HIGHEST function:<br />
 <pre style="margin:20px; line-height:13px">(defun COUNT-HIGHEST (lists)<br />
&nbsp; &quot;Returns the highest occuring pattern in its arg.&quot;<br />
&nbsp; (let* ((sorted-numbers (my-sort #'&lt; (mapcar #'second lists))) <br />
&nbsp; &nbsp; &nbsp; &nbsp;  (numbers-only (remove-duplicates sorted-numbers))&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  (counts (count-them numbers-only sorted-numbers)))&nbsp; &nbsp;  <br />
&nbsp; &nbsp; (find-all (nth (position (first (my-sort #'&gt; counts)) counts) numbers-only)&nbsp; lists)))</pre><br />
And the sort function that it calls:<br />
 <pre style="margin:20px; line-height:13px">(defun MY-SORT (function lists)<br />
&nbsp; &quot;Non-destructive sort function.&quot;<br />
&nbsp; (loop for item in (sort (loop for array-2 in lists<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collect (list array-2))&nbsp; function :key #'car)<br />
&nbsp; &nbsp; &nbsp; &nbsp; collect (first item)))</pre><br />
FYI: array-2 is an array of floats.<br />
Thanks!<br />
<br />
BTW:<br />
If anyone is curious, these two pieces of code come from a program called &quot;Network&quot; written by David Cope. The full program along with others can be found <a rel="nofollow" class="t" href="http://artsites.ucsc.edu/faculty/cope/cmmc.html" target="_blank">here</a>. Unfortunately all of his files are archived in .sit format, so you'll need StuffIt Expander to open them.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>klactose</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241444.html</guid>
		</item>
		<item>
			<title>How to connect oracle database using ado.net</title>
			<link>http://www.daniweb.com/forums/thread241411.html</link>
			<pubDate>Thu, 26 Nov 2009 01:21:18 GMT</pubDate>
			<description>HI friend can you tell me how to connect and retrieve data from mySQL and oracle database using ado.net in C#.</description>
			<content:encoded><![CDATA[<div>HI friend can you tell me how to connect and retrieve data from mySQL and oracle database using ado.net in C#.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>senthilg</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241411.html</guid>
		</item>
		<item>
			<title>Close Event</title>
			<link>http://www.daniweb.com/forums/thread241409.html</link>
			<pubDate>Thu, 26 Nov 2009 00:29:45 GMT</pubDate>
			<description><![CDATA[Hi guys i am trying to catch the close event(press the X button) on a window form. 
I try this 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with...]]></description>
			<content:encoded><![CDATA[<div>Hi guys i am trying to catch the close event(press the X button) on a window form.<br />
I try this<br />
 <pre style="margin:20px; line-height:13px"> private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; // Display a MsgBox asking the user to save changes or abort.<br />
&nbsp; &nbsp; &nbsp; if(MessageBox.Show(&quot;Do you want to save changes to your text?&quot;, &quot;My Application&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  MessageBoxButtons.YesNo) ==&nbsp; DialogResult.Yes)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  // Cancel the Closing event from closing the form.<br />
&nbsp; &nbsp; &nbsp; &nbsp;  e.Cancel = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  // Call method to save file...<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre>But do nothing. <br />
Any ideas??? What i am doing wrong</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>lepass_7</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241409.html</guid>
		</item>
		<item>
			<title>listBox</title>
			<link>http://www.daniweb.com/forums/thread241393.html</link>
			<pubDate>Wed, 25 Nov 2009 22:12:02 GMT</pubDate>
			<description>In my C# Class I have a Windows Form with 4 checkBoxes and 1 listBox.  Three of the checkBoxes are Ford, Chevrolet, and Cadillac; and the 4th is All.     
 
Checking each box displays that make of car OR all cars.  Unchecking each Box removes that car from the listbox.  So, if you check Ford,...</description>
			<content:encoded><![CDATA[<div>In my C# Class I have a Windows Form with 4 checkBoxes and 1 listBox.  Three of the checkBoxes are Ford, Chevrolet, and Cadillac; and the 4th is All.    <br />
<br />
Checking each box displays that make of car OR all cars.  Unchecking each Box removes that car from the listbox.  So, if you check Ford, Chevrolet, and Cadillac AND THEN unCheck Ford you would be left with only Cadillac and Chevrolet.<br />
<br />
My problem is the ALL.  When I click ALL four checkBoxes the ALL list is appended to the list of the other three and when you uncheck all (using ...items.clear()) it removes everything.<br />
<br />
The Demo program for this project Displays ALL by itself and it seems to operate independently of the other 3.  Like it is either overlaying the list OR there is another listBox of a different name but the exact same size that is only visible when the allCheckBox.Checked == true.<br />
<br />
Is there a way to do this without a second listbox?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>jduff8</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241393.html</guid>
		</item>
		<item>
			<title>checkedListBox</title>
			<link>http://www.daniweb.com/forums/thread241391.html</link>
			<pubDate>Wed, 25 Nov 2009 22:05:06 GMT</pubDate>
			<description>I am taking a C# Class and have two questions about a program we are writing.  It consists of a checkedListBox that displays 3 makes of Car by Group and then the ModelYear like: 
Ford 
  2007 
  2006 
  2005 
Chevrolet 
  2004 
  2004   etc 
 
The listBox is filled using LINQ from an Access DB</description>
			<content:encoded><![CDATA[<div>I am taking a C# Class and have two questions about a program we are writing.  It consists of a checkedListBox that displays 3 makes of Car by Group and then the ModelYear like:<br />
Ford<br />
  2007<br />
  2006<br />
  2005<br />
Chevrolet<br />
  2004<br />
  2004   etc<br />
<br />
The listBox is filled using LINQ from an Access DB<br />
I have two issues:<br />
       1)   Each line has a checkBox...how do I disable the checkBox <br />
             for the Group / CarMake?<br />
<br />
        2)  How do I allow a Year to be selected, then get the Make<br />
             that goes with it so I can retrieve the price and display all<br />
             three in a TextBox at the bottom?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>jduff8</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241391.html</guid>
		</item>
		<item>
			<title><![CDATA[Beginner's question about Custom Controls]]></title>
			<link>http://www.daniweb.com/forums/thread241353.html</link>
			<pubDate>Wed, 25 Nov 2009 18:16:33 GMT</pubDate>
			<description><![CDATA[Hi, I'm just starting to learn how to create custom controls in C# but I'm having a problem with the toolbox here. 
 
After creating and compiling the custom control in the Library project, i add new project to the solution to test my new control, so i add reference like every tutorial instructs....]]></description>
			<content:encoded><![CDATA[<div>Hi, I'm just starting to learn how to create custom controls in C# but I'm having a problem with the toolbox here.<br />
<br />
After creating and compiling the custom control in the Library project, i add new project to the solution to test my new control, so i add reference like every tutorial instructs. However, i got stuck because of the toolbox, it does not display my control, can anybody help telling me what the problem is?<br />
<br />
Thanks a lot for reading.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>kalodakilla</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241353.html</guid>
		</item>
		<item>
			<title>server application capturing audio from Skype</title>
			<link>http://www.daniweb.com/forums/thread241293.html</link>
			<pubDate>Wed, 25 Nov 2009 13:52:31 GMT</pubDate>
			<description><![CDATA[Hello! 
 
I'd like to create little system for mobile phones which can recognize speech. There are two ways to do it, first is to have speech recognition on mobile phone (however I've got difficulties with using PocketSphinx, if you'd like me to, I can explain what exactly), the other is to have...]]></description>
			<content:encoded><![CDATA[<div>Hello!<br />
<br />
I'd like to create little system for mobile phones which can recognize speech. There are two ways to do it, first is to have speech recognition on mobile phone (however I've got difficulties with using PocketSphinx, if you'd like me to, I can explain what exactly), the other is to have speech recognition on server and just have mobile phone connecting to that server with the use of Skype. The communication between devices and applications would be as follows: Skype on mobile phone calls Skype on server -&gt; Skype on server redirects the speech (with the use of server application) to speech recognition engine Sphinx4 -&gt; Sphinx4 recognizes the speech and answers to Skype (do I need to do it through the server application?). Recently I've been working on creating acoustic model for Sphinx4.<br />
<br />
I have already found some good code which I can use in my application: <a rel="nofollow" class="t" href="http://forum.skype.com/index.php?showtopic=260361&amp;st=0&amp;p=1158301&amp;#entry1158301" target="_blank">http://forum.skype.com/index.php?sho...&amp;#entry1158301</a> . However I don't have the experience in writing server applications. (I've got some experience in C++, Free Pascal and Visual Basic but I'm rather newbie in C#). Can you suggest me how to begin with writing this server application? I would appreciate it if you can give me some useful materials to read, tutorials or advices.<br />
<br />
Greetings!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>johnyjj2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241293.html</guid>
		</item>
		<item>
			<title>Newbie problem</title>
			<link>http://www.daniweb.com/forums/thread241282.html</link>
			<pubDate>Wed, 25 Nov 2009 13:16:41 GMT</pubDate>
			<description><![CDATA[hi everyone, i'm new here also new in c#.Please help me to re-populate my listview in form1 from the database when i close form2(modal). is is from form2 formClosing event 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>hi everyone, i'm new here also new in c#.Please help me to re-populate my listview in form1 from the database when i close form2(modal). is is from form2 formClosing event<br />
 <pre style="margin:20px; line-height:13px">private void Client_FormClosing(object sender, FormClosingEventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.Cancel = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ClientInfo a = new ClientInfo();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a.displayClient();//displayClient() is responsible for displaying&nbsp;  //items from database<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //also i called it during form1_Load()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a.Show();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre>Is there something wrong with my displayClient()? here it is from form1<br />
 <pre style="margin:20px; line-height:13px">public void displayClient()<br />
&nbsp; &nbsp; &nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dbClient db = new dbClient();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string con = db.Mycon();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MySqlConnection cnMySQL = new MySqlConnection(con);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cnMySQL.Open();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MySqlCommand cmdMySQL = cnMySQL.CreateCommand();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MySqlDataReader reader;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmdMySQL.CommandText = &quot;select * from CLIENT&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader = cmdMySQL.ExecuteReader();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvClient.Items.Clear();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;hi&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (reader.Read())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = reader.FieldCount;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListViewItem item1 = new ListViewItem(reader.GetString(0), i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item1.SubItems.Add(reader.GetString(1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item1.SubItems.Add(reader.GetString(2));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item1.SubItems.Add(reader.GetString(3));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item1.SubItems.Add(reader.GetString(4));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Add the items to the ListView.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvClient.Items.AddRange(new ListViewItem[] { item1 });<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Add the ListView to the control collection.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(lvClient);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cnMySQL.Close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre>Please help.Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>prilton</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241282.html</guid>
		</item>
		<item>
			<title>3 Question</title>
			<link>http://www.daniweb.com/forums/thread241259.html</link>
			<pubDate>Wed, 25 Nov 2009 11:13:00 GMT</pubDate>
			<description>I have been asked 3 questions and would like someone to give me the code for each of these questions so that i can find out the answer. 
 
no.1 
 
A salesperson earns a commission on the value of sales. The following table shows the scale of the commission. Write a program to input the value of...</description>
			<content:encoded><![CDATA[<div>I have been asked 3 questions and would like someone to give me the code for each of these questions so that i can find out the answer.<br />
<br />
no.1<br />
<br />
A salesperson earns a commission on the value of sales. The following table shows the scale of the commission. Write a program to input the value of sales, and calculate and output the commission.<br />
<br />
	values of sales		% commission<br />
	£1 - £999				1<br />
	£1000 - £9999			5<br />
	£10000 - £99999			10<br />
<br />
no.2<br />
<br />
A worker is paid at the hourly rate of £8 per hour for the first 35 hours worked. Thereafter overtime is paid at 1.5 times the hourly rate for the next 25 hours worked and 2 times the hourly rate for further hours worked. Write a program to input the number of hours worked per week, calculate and output the overtime paid.<br />
<br />
no.3<br />
<br />
Write a program to input two real numbers and give the user the choice of adding, subtracting, multiplying or dividing these numbers. Perform the appropriate calculation and display the result. Your program should trap any attempt to divide by zero.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Blue_Eyez</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241259.html</guid>
		</item>
		<item>
			<title>How to create a variable in a class to be seen in report viewer</title>
			<link>http://www.daniweb.com/forums/thread241240.html</link>
			<pubDate>Wed, 25 Nov 2009 09:43:35 GMT</pubDate>
			<description>I have a class which is used as a object for my reportviewer control in C#. The Datatable in that class is used by the control to show a  table. 
I have two issues. 
1  How to create a varibale  in that class that can be accessed by the reportviewer? The purpose is to send some calculated results...</description>
			<content:encoded><![CDATA[<div>I have a class which is used as a object for my reportviewer control in C#. The Datatable in that class is used by the control to show a  table.<br />
I have two issues.<br />
1  How to create a varibale  in that class that can be accessed by the reportviewer? The purpose is to send some calculated results to report. I created a property (get ,set) but it shows some stack overflow in class constructer. How to do that?<br />
2.I tried to create another table in the class but all the colums I load in one table appears in next also.<br />
<br />
Any help for me?<br />
<br />
Thanks<br />
Roy Thomas</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>RoyMicro</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241240.html</guid>
		</item>
		<item>
			<title>HttpWebRequest,HttpWebResponse</title>
			<link>http://www.daniweb.com/forums/thread241233.html</link>
			<pubDate>Wed, 25 Nov 2009 09:29:36 GMT</pubDate>
			<description><![CDATA[Hi 
I attached here a code that i have a problem with. 
the function CheckStatusCode() suppose to connect to uri and check the http response status. 
it should display on the screen the status received. usually the status is "OK" (200). but for instance if the page doesn't exist the status should...]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
I attached here a code that i have a problem with.<br />
the function CheckStatusCode() suppose to connect to uri and check the http response status.<br />
it should display on the screen the status received. usually the status is &quot;OK&quot; (200). but for instance if the page doesn't exist the status should be &quot;NOT FOUND&quot; (404).<br />
the function works fine with uri that returns status 200.<br />
in any other status, i.e 404, the method throws exception.<br />
basically i can parse the the exception message and understand the status from there, but i don&quot;t see a reason to do so.<br />
<br />
please help me understand why i'am getting exception and the function doesn't do what it supposed to do.<br />
<br />
 <pre style="margin:20px; line-height:13px">using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Net;<br />
using System.Windows.Forms;<br />
using System.IO;<br />
namespace Configurator<br />
{<br />
&nbsp; &nbsp; class Navigation<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void CheckStatusCode()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HttpWebRequest request=null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HttpWebResponse response=null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; request = (HttpWebRequest)WebRequest.Create(&quot;http://www.ynet.co.il&quot;);//OK 200<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //request = (HttpWebRequest)WebRequest.Create(&quot;https://yedion.afeka.ac.il/yedion/dxcbfgdfsg&quot;);//NOT FOUND 404<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response = (HttpWebResponse)request.GetResponse();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(response.StatusCode.ToString());<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; MessageBox.Show(e.Message);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finally<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response.Close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>igalbk</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241233.html</guid>
		</item>
		<item>
			<title>Adaptive thresholding</title>
			<link>http://www.daniweb.com/forums/thread241232.html</link>
			<pubDate>Wed, 25 Nov 2009 09:27:53 GMT</pubDate>
			<description>Hi, 
 
I am implementing a project where I have to use adaptive thresholding on an image. That is, the threshold value must not be global, but must adapt itself with the image. I have thought a lot, but am unable to get a logic. It would be really helpful if someone can help me with the code, or...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am implementing a project where I have to use adaptive thresholding on an image. That is, the threshold value must not be global, but must adapt itself with the image. I have thought a lot, but am unable to get a logic. It would be really helpful if someone can help me with the code, or atleast the logic</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sathya8819</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241232.html</guid>
		</item>
		<item>
			<title>Help With Open File Notification</title>
			<link>http://www.daniweb.com/forums/thread241214.html</link>
			<pubDate>Wed, 25 Nov 2009 08:11:24 GMT</pubDate>
			<description>hi frds ... 
 
I want to notify my application whenver user open any file. 
i just want to notify the name of that file, which is opend by user. 
 
how can achive this. 
 
FileSystemWatcher class is not giving this facilities. 
 
I want only notification for opening any file..</description>
			<content:encoded><![CDATA[<div>hi frds ...<br />
<br />
I want to notify my application whenver user open any file.<br />
i just want to notify the name of that file, which is opend by user.<br />
<br />
how can achive this.<br />
<br />
FileSystemWatcher class is not giving this facilities.<br />
<br />
I want only notification for opening any file..<br />
<br />
please reply whaterver you know.IF any trick or logic is there than also let me know....please ...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>crazyboy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241214.html</guid>
		</item>
		<item>
			<title>Download File from Database (SQL Server 2005 - C#)</title>
			<link>http://www.daniweb.com/forums/thread241164.html</link>
			<pubDate>Wed, 25 Nov 2009 04:06:40 GMT</pubDate>
			<description><![CDATA[Hi ..  
 
I have been asked to create a new thread rather than recurrent on old post (http://www.daniweb.com/forums/thread116468-2.html), hope to get some help here... :) 
 
 
I would like to have a "Extract" button which then open a Save As dialog to save the file from the Database into local pc,...]]></description>
			<content:encoded><![CDATA[<div>Hi .. <br />
<br />
I have been asked to create a new thread rather than recurrent on old post (<a rel="nofollow" class="t" href="http://www.daniweb.com/forums/thread116468-2.html" target="_blank">http://www.daniweb.com/forums/thread116468-2.html</a>), hope to get some help here... :)<br />
<br />
<br />
I would like to have a &quot;Extract&quot; button which then open a Save As dialog to save the file from the Database into local pc, the SqlFileHolder provided in <a rel="nofollow" class="t" href="http://www.daniweb.com/forums/thread116468-1.html" target="_blank">http://www.daniweb.com/forums/thread116468-1.html</a> , work nice for me, but just wanted to have additional stuff by downloading the file.<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
private void saveFile(object sender, System.EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // open SaveFileDialog so the user can save the file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SaveFileDialog saveFileDialog1 = new SaveFileDialog();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveFileDialog1.Title = &quot;Save File..&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveFileDialog1.ShowDialog();<br />
...<br />
}</pre><br />
How could i proceed to get the file from the database and save into my local pc from the code above?<br />
<br />
Thank you.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>eURe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241164.html</guid>
		</item>
		<item>
			<title>Convert String to Datetime?</title>
			<link>http://www.daniweb.com/forums/thread241105.html</link>
			<pubDate>Tue, 24 Nov 2009 21:43:37 GMT</pubDate>
			<description><![CDATA[I have a String stored in this format "10/10/2009 12:00:00". 
I would like to convert this into a DateTime object so I can add it into the Outlook calender.  
I have tried using the following code but it doesnt seem to work. 
DateTime startDate = DateTime.Parse(appointments[i]);  
(where...]]></description>
			<content:encoded><![CDATA[<div>I have a String stored in this format &quot;10/10/2009 12:00:00&quot;.<br />
I would like to convert this into a DateTime object so I can add it into the Outlook calender. <br />
I have tried using the following code but it doesnt seem to work.<br />
DateTime startDate = DateTime.Parse(appointments[i]); <br />
(where appointments[i] is a string in a point in an array)<br />
<br />
I have also tried using the following code to parse butit hasnt lead to anything for me: <br />
System.Globalization.DateTimeFormatInfo info = new System.Globalization.DateTimeFormatInfo();<br />
<br />
Can somebody show me how to parse the above format or by another method i cant seem to get to work either way. Many thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Drahmina</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241105.html</guid>
		</item>
		<item>
			<title>zoom</title>
			<link>http://www.daniweb.com/forums/thread241084.html</link>
			<pubDate>Tue, 24 Nov 2009 19:31:44 GMT</pubDate>
			<description>hi 
i have a graph which i have to zoom in and zoom out dynamically. i have drew the graph in a panel.  
any ideas plzzzzzz</description>
			<content:encoded><![CDATA[<div>hi<br />
i have a graph which i have to zoom in and zoom out dynamically. i have drew the graph in a panel. <br />
any ideas plzzzzzz</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sidd.</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241084.html</guid>
		</item>
		<item>
			<title>Validation in textboxe</title>
			<link>http://www.daniweb.com/forums/thread241075.html</link>
			<pubDate>Tue, 24 Nov 2009 18:54:23 GMT</pubDate>
			<description>Hello 
 
I have one textBox...let say i want some to enter their name in textbox but i dont want user to enter integer value in text ONLY character. 
 
can any one here tell how to make program for this OR any inbuilt function is there. 
 
I m using visual studio 2005 
 
Thanks</description>
			<content:encoded><![CDATA[<div>Hello<br />
<br />
I have one textBox...let say i want some to enter their name in textbox but i dont want user to enter integer value in text ONLY character.<br />
<br />
can any one here tell how to make program for this OR any inbuilt function is there.<br />
<br />
I m using visual studio 2005<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>th3learner</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241075.html</guid>
		</item>
		<item>
			<title>Update database from DataGridView</title>
			<link>http://www.daniweb.com/forums/thread241040.html</link>
			<pubDate>Tue, 24 Nov 2009 15:40:52 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I'm using C#, Access 2007 and VS2008 to write a windows app.  
 
I have populated a datagridview from a query (taking data from 2 tables).  When the user clicks "Save", I want to be able to save any changes made in the datagridview to the database.  Only one column in the datagridview is...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I'm using C#, Access 2007 and VS2008 to write a windows app. <br />
<br />
I have populated a datagridview from a query (taking data from 2 tables).  When the user clicks &quot;Save&quot;, I want to be able to save any changes made in the datagridview to the database.  Only one column in the datagridview is editable, so any changes will be made to just the one table in the database.<br />
<br />
I could possibly do something using the CellEndEdit event, but that would fire for each cell that is updated, which is a bit clunky.  <br />
<br />
So, can anyone please tell me how I can write data back to the database, when the original datagridview is populated from a query?<br />
<br />
Thanks in advance,<br />
Jon</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>jonnod123</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241040.html</guid>
		</item>
		<item>
			<title>Listbox and SelectedValueChanged Method</title>
			<link>http://www.daniweb.com/forums/thread241037.html</link>
			<pubDate>Tue, 24 Nov 2009 15:31:42 GMT</pubDate>
			<description>I have question about the listbox. My listbox is binding to a database, and I use SelectedValueChanged to determine which my record I chose, I also get a couple button to interact with the sorting but the problem is whenever I change the database, like update new sql query, it loads the listbox...</description>
			<content:encoded><![CDATA[<div>I have question about the listbox. My listbox is binding to a database, and I use SelectedValueChanged to determine which my record I chose, I also get a couple button to interact with the sorting but the problem is whenever I change the database, like update new sql query, it loads the listbox again. And the time that listbox is loading, it triggers the SelectedValueChanged also. I try to use bool flag but I don't know how the flow of the program.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>NguyenThai</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241037.html</guid>
		</item>
		<item>
			<title>How to insert the Datagridview data?</title>
			<link>http://www.daniweb.com/forums/thread241130.html</link>
			<pubDate>Tue, 24 Nov 2009 15:01:15 GMT</pubDate>
			<description>i want to insert the datagridview data and other ouside columns data into a single table ,database is sqlserver by using c# can anybody help.</description>
			<content:encoded><![CDATA[<div>i want to insert the datagridview data and other ouside columns data into a single table ,database is sqlserver by using c# can anybody help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sivait.mca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241130.html</guid>
		</item>
		<item>
			<title>Overlapping regions</title>
			<link>http://www.daniweb.com/forums/thread241015.html</link>
			<pubDate>Tue, 24 Nov 2009 14:20:10 GMT</pubDate>
			<description>I am implementing a code to detect overlapping regions in a cell, as shown in the attachment. As you can see, the image is an overlapped version of two cells. My aim is to separate them. But I have got no clue whatsoever to do this. Can anyone help me</description>
			<content:encoded><![CDATA[<div>I am implementing a code to detect overlapping regions in a cell, as shown in the attachment. As you can see, the image is an overlapped version of two cells. My aim is to separate them. But I have got no clue whatsoever to do this. Can anyone help me</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/zip.gif" alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12696&amp;d=1259072352">091124091019-19506.zip</a> (19.7 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sathya8819</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241015.html</guid>
		</item>
		<item>
			<title>How transfer data between 2 DataBase MySQL</title>
			<link>http://www.daniweb.com/forums/thread240973.html</link>
			<pubDate>Tue, 24 Nov 2009 11:53:31 GMT</pubDate>
			<description><![CDATA[I Want transfer updated data between 2 Database MySQL that One of them is in the server Host and other is over localhost . 
Now What should I do? 
 
I'm waiting for your answer]]></description>
			<content:encoded><![CDATA[<div>I Want transfer updated data between 2 Database MySQL that One of them is in the server Host and other is over localhost .<br />
Now What should I do?<br />
<br />
I'm waiting for your answer</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>jas2010</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240973.html</guid>
		</item>
		<item>
			<title>Nucleus Detection</title>
			<link>http://www.daniweb.com/forums/thread240945.html</link>
			<pubDate>Tue, 24 Nov 2009 10:10:35 GMT</pubDate>
			<description>i am working on a single cell image to detect the nucleus. 
Logic used-  
1. i am detecting the darkest pixel in the cell(which in most cases belongs to the nucleus) 
2. using canny edge detection to detect the edges.(low threshold=0, high threshold=0, sigma=3) 
3. threshold with a value of 1 and...</description>
			<content:encoded><![CDATA[<div>i am working on a single cell image to detect the nucleus.<br />
Logic used- <br />
1. i am detecting the darkest pixel in the cell(which in most cases belongs to the nucleus)<br />
2. using canny edge detection to detect the edges.(low threshold=0, high threshold=0, sigma=3)<br />
3. threshold with a value of 1 and make all the edges white in colour.<br />
4. Starting from the darkest pixel, i traverse all the neighbours till i reach the nearest edge.<br />
<br />
This works for most cases and detects the nucleus well.<br />
But, sometimes, the edge detection does not form a fully closed curve around the nucleus and leaves a gap at few areas. so when i traverse thru neighbor pixels, the pointer crosses the required area thru the small gaps and goes into other parts of the image.<br />
<br />
i want a solution that will form closed curves, i.e fill up the gaps in the edges.<br />
i tried the dilating the image and then eroding it. it closes some curves but not all.<br />
<br />
 <pre style="margin:20px; line-height:13px">unsafe public Bitmap execute2(Bitmap inputImage, Bitmap temp)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitmapData inputImageData = inputImage.LockBits(new Rectangle(0, 0, inputImage.Width, inputImage.Height),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* inputImagePtr = (byte*)(void*)inputImageData.Scan0.ToPointer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitmapData tempData = temp.LockBits(new Rectangle(0, 0, inputImage.Width, inputImage.Height),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* tempPtr = (byte*)(void*)tempData.Scan0.ToPointer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i, j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Point maxIntensity = new Point();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Point curr = new Point();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Point neigh = new Point();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Byte max = 255;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Stack&lt;Point&gt; points = new Stack&lt;Point&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Stack&lt;Point&gt; check = new Stack&lt;Point&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (i = 0; i &lt; temp.Height; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (j = 0; j &lt; temp.Width; j++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (inputImagePtr[i * temp.Width + j] != 255)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (inputImagePtr[i * temp.Width + j] &lt; max &amp;&amp; tempPtr[i * temp.Width + j]!=255)<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; max = inputImagePtr[i * temp.Width + j];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxIntensity.X = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxIntensity.Y = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int width = temp.Width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int height = temp.Height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; points.Push(maxIntensity);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (points.Count != 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curr = points.Pop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (tempPtr[curr.Y * width + curr.X] != 255 &amp;&amp; curr.X &gt; 0 &amp;&amp; curr.X &lt; width - 1 &amp;&amp; curr.Y &gt; 0 &amp;&amp; curr.Y &lt; height - 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.X = curr.X - 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.Y = curr.Y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (check.Contains(neigh) == false)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; points.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; check.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputImagePtr[neigh.Y * width + neigh.X] = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.X = curr.X + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.Y = curr.Y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (check.Contains(neigh) == false)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; points.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; check.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputImagePtr[neigh.Y * width + neigh.X] = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.X = curr.X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.Y = curr.Y - 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (check.Contains(neigh) == false)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; points.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; check.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputImagePtr[neigh.Y * width + neigh.X] = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.X = curr.X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; neigh.Y = curr.Y + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (check.Contains(neigh) == false)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; points.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; check.Push(neigh);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputImagePtr[neigh.Y * width + neigh.X] = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputImage.UnlockBits(inputImageData);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.UnlockBits(tempData);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return inputImage;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
inputImage- original grayscale image with white background<br />
temp- after canny, dilation, erosion (black background, white edges)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>vikram89</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240945.html</guid>
		</item>
		<item>
			<title>FileSystemWatcher question</title>
			<link>http://www.daniweb.com/forums/thread240831.html</link>
			<pubDate>Tue, 24 Nov 2009 00:08:31 GMT</pubDate>
			<description>I want to use FileSystemWatcher to monitor directory containing 
log files, and parse them on changed. However, the bad person who wrote program creating logs, coded it so the log files are never actually closed. And though I can access them in FileShare.ReadWrite mode, the FileSystemWatcher...</description>
			<content:encoded><![CDATA[<div>I want to use FileSystemWatcher to monitor directory containing<br />
log files, and parse them on changed. However, the bad person who wrote program creating logs, coded it so the log files are never actually closed. And though I can access them in FileShare.ReadWrite mode, the FileSystemWatcher actually never arises any events. So is there any walkaround for this issue?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>whee</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240831.html</guid>
		</item>
		<item>
			<title>Instance</title>
			<link>http://www.daniweb.com/forums/thread240803.html</link>
			<pubDate>Mon, 23 Nov 2009 21:51:33 GMT</pubDate>
			<description>Well, I have a main form (Form1) and a second form (Form2) which is a preference box. Anyways, I made a combobox and a button on the second form, and a button on the first form which opens up the new one. Everything works well until you try to use the combo box to change the client size, this...</description>
			<content:encoded><![CDATA[<div>Well, I have a main form (Form1) and a second form (Form2) which is a preference box. Anyways, I made a combobox and a button on the second form, and a button on the first form which opens up the new one. Everything works well until you try to use the combo box to change the client size, this worked before when it wasn't on a new form, so I know it's meant to be working.<br />
<br />
Here is my code:<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; private void button1_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Form1 f1 = new Form1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (comboBox1.Text == &quot;800x600&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f1.ClientSize = new System.Drawing.Size(800, 600);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (comboBox1.Text == &quot;300x300&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f1.ClientSize = new System.Drawing.Size(300, 300);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Jaydenn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240803.html</guid>
		</item>
		<item>
			<title>Convert DataSet to List</title>
			<link>http://www.daniweb.com/forums/thread240770.html</link>
			<pubDate>Mon, 23 Nov 2009 18:36:50 GMT</pubDate>
			<description><![CDATA[This is the code I have: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>...]]></description>
			<content:encoded><![CDATA[<div>This is the code I have:<br />
 <pre style="margin:20px; line-height:13px">public class BusinessLayer<br />
{<br />
&nbsp; &nbsp; public Employee[] GetAllEmployees() <br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Employee[] employees;<br />
&nbsp; &nbsp; &nbsp; &nbsp; DataSet myDataSet = DataBaseLayer.GetAllEmployees();<br />
<br />
&nbsp; &nbsp; &nbsp; /// How can I convert the myDataSet to Employee List<br />
&nbsp; &nbsp; &nbsp; return employees;<br />
&nbsp;  }&nbsp; &nbsp;  <br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240770.html</guid>
		</item>
		<item>
			<title>Progress Bar - Scan files...</title>
			<link>http://www.daniweb.com/forums/thread240736.html</link>
			<pubDate>Mon, 23 Nov 2009 15:56:32 GMT</pubDate>
			<description><![CDATA[Hello... 
 
I have created application (duplicate file detector) and now I have a progress bar and I want synchronize "how many percentage of scan is ready" 
 
Here is my code for scanning: 
 
 
private void scanFiles(string rootDirectory) 
        { 
            try]]></description>
			<content:encoded><![CDATA[<div>Hello...<br />
<br />
I have created application (duplicate file detector) and now I have a progress bar and I want synchronize &quot;how many percentage of scan is ready&quot;<br />
<br />
Here is my code for scanning:<br />
<br />
 <pre style="margin:20px; line-height:13px">private void scanFiles(string rootDirectory)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (stop)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (string dir in Directory.GetDirectories(rootDirectory))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (stop)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Application.DoEvents();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (dir.ToLower().IndexOf(&quot;$recycle.bin&quot;) == -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; scanFiles(dir);<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; foreach (string file in Directory.GetFiles(rootDirectory))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (stop)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Application.DoEvents();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Here is Code for comparing...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(ex.Message);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
So... how to set progress bar to show &quot;how many percentage of scan is ready&quot; ?<br />
<br />
Thanks...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Krstevski</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240736.html</guid>
		</item>
		<item>
			<title>Listbox selected index changed</title>
			<link>http://www.daniweb.com/forums/thread240715.html</link>
			<pubDate>Mon, 23 Nov 2009 14:26:00 GMT</pubDate>
			<description><![CDATA[Hello everyone, 
I am working on a project that when a user select an item in the listbox data will display in the textboxes. I saw a thread named "Experiment with ListBox in C#", this thread does cover what I am trying to implement on my project. I copied and pasted that code into Visual C# 2008...]]></description>
			<content:encoded><![CDATA[<div>Hello everyone,<br />
I am working on a project that when a user select an item in the listbox data will display in the textboxes. I saw a thread named &quot;Experiment with ListBox in C#&quot;, this thread does cover what I am trying to implement on my project. I copied and pasted that code into Visual C# 2008 and it does not fire. That is the problem I have been having ever since the school project. The school project was submitted for grading already done deal. LOL<br />
<br />
<span style="font-weight:bold">School project:</span><br />
This is an address book with arrays. single dimension.<br />
firstname, lastname, address, city, state, zip<br />
Six textboxes, listbox, add btn, deletebtn, exitbtn. <br />
<br />
The user is to enter data into textboxes, display only names to listbox sorted in alphabetical order<br />
<br />
The user select a name in listbox, display address information to textbox.<br />
<br />
I am having the problem that when I select a name to display addresses to the textbox it does nothing to display.<br />
<br />
 <pre style="margin:20px; line-height:13px">//this suppose to fire when user select an item in listbox to textbox<br />
//I think this is where i am having the problem<br />
private void lstNames_SelectedIndexChanged(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Displays address into the text boxes. <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Sets the array count variable makes sure index is not -1.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (lstNames.SelectedIndex &gt; 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string arrayName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayName = lstNames.SelectedItem.ToString();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Loop through the arrayString to display the address of each person.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int index = 0; index &gt; 20; index++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (lstNames.ToString() == arrayName)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; if names match then set the text box text to the array location elements.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtlastname.Text = arrayString[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtfirstname.Text = arrayString[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtAddress.Text = arrayString[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtCity.Text = arrayString[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtState.Text = arrayString[4];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtZip.Text = arrayString[5];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&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; //did not find the data show the error messagebox<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;Address not found!&quot;, &quot;Data Error Entry&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
<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;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
 <pre style="margin:20px; line-height:13px">//this is my class-level <br />
public partial class Form1 : Form<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int Counter = 0;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //declaring array with 20 elements<br />
&nbsp; &nbsp; &nbsp; &nbsp; public string[] arrayString = new string[20];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Form1()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
 <pre style="margin:20px; line-height:13px">//my add button with stored array store up to 20 entries<br />
//I can add entries without a problem<br />
//also clears textbox for next entry and sort alphabetical order<br />
//no problem with this<br />
private void btnAdd_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //execute the counter as incrementor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Counter++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //declare variable as integer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int arrayCounter;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //compare the counter less than 20<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Counter &lt;= 20)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //then arrayCounter will either add or equal to 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayCounter = Counter += 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //initializing and store array to display to textbox<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayString[0] = txtlastname.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayString[1] = txtfirstname.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayString[2] = txtAddress.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayString[3] = txtCity.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayString[4] = txtState.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayString[5] = txtZip.Text;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add a list of names by lastname with separator as format<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lstNames.Items.Add(arrayString[0] + &quot;, &quot; + arrayString[1]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //alphabetical order<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lstNames.Sorted = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //string empty and brings back the focus to lastname textbox<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //making room for more information<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtfirstname.Text = String.Empty;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtlastname.Text = String.Empty;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtAddress.Text = String.Empty;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtCity.Text = String.Empty;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtState.Text = String.Empty;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtZip.Text = String.Empty;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtfirstname.Focus();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //otherwise an error messagebox will appear <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //alerting the user that only 20 entries are permitted<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;You've reached 20 Addresses...permitted&quot;, &quot;Error&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
 <pre style="margin:20px; line-height:13px">//this delete entry from the listbox when user select an item<br />
//no problem is does delete an entry in listbox<br />
private void btnDelete_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //decision to delete a record from listbox<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (lstNames.SelectedIndex &gt; -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lstNames.Items.RemoveAt(lstNames.SelectedIndex);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
I have been working on this project for over a week.<br />
This is the introduction to C# class, not an advanced class.<br />
But I am also curious, if the I enter data in the textboxes and click on add the names will only show in the listbox, but then since this is an array it suppose to be stored in the array memory, so when I select a name in the listbox the addresses suppose to display in the textboxes? <br />
<br />
I greatly appreciate for your assistance, I really need to learn this.<br />
Thanks!<br />
<br />
Regards,<br />
<br />
Desi Bravo</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>bravo659</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240715.html</guid>
		</item>
		<item>
			<title>kuwahara filter - image processing</title>
			<link>http://www.daniweb.com/forums/thread240675.html</link>
			<pubDate>Mon, 23 Nov 2009 11:15:39 GMT</pubDate>
			<description><![CDATA[Hi. I am implementing the Kuwahara Filter in c#. The code for this is given below.  
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>Hi. I am implementing the Kuwahara Filter in c#. The code for this is given below. <br />
 <pre style="margin:20px; line-height:13px">unsafe<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bitmap bmps = (Bitmap)pictureBox1.Image;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bitmap bmpd = (Bitmap)pictureBox1.Image.Clone();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitmapData bms = bmps.LockBits(new Rectangle(0, 0, bmps.Width, bmps.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitmapData bmd = bmpd.LockBits(new Rectangle(0, 0, bmpd.Width, bmpd.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* b1 = (byte*)(void*)bms.Scan0.ToPointer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* b2 = (byte*)(void*)bmd.Scan0.ToPointer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += (2 * bmd.Width * 3 + 2 * 3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] bm = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] gm = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] rm = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float s, yy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] bx = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] gx = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] rx = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] mi = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float[] mv = { (float)0.0, (float)0.0, (float)0.0, (float)0.0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x, y, ctr = 0, ctr1 = 0,i1,j1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int r;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 2; i &lt;= pictureBox1.Height - 2; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i1 = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int j = 2; j &lt;= pictureBox1.Width - 2; j++)<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; j1 = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //region 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bb = gg = rr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = i - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = j - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; if (ctr == 3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; x = x + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = j - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; mi[0] += (float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[0] += (float)b2[x * bmd.Stride + y];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[0] += (float)b2[x * bmd.Stride + y + 1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[0] += (float)b2[x * bmd.Stride + y + 2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = y + 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ctr1 == 9)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &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; mi[0] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[0] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[0] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[0] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = i - 2; x &lt;= i; x++)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; for (y = j - 2; y &lt;= j; y++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; mv[0] += (float)Math.Pow((float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3)) - mi[0], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gg += (float)Math.Pow(b2[x * bmd.Stride + y + 1], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rr += (float)Math.Pow(b2[x * bmd.Stride + y + 2], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mv[0] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bx[0] = bb / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gx[0] = gg / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rx[0] = rr / 9;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //region 2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr1 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bb = gg = rr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = i - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = 3*j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; if (ctr == 3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; x = x + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = j - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; mi[1] += (float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[1] += (float)b2[x * bmd.Stride + y];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[1] += (float)b2[x * bmd.Stride + y + 1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[1] += (float)b2[x * bmd.Stride + y + 2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = y + 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ctr1 == 9)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &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; mi[1] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[1] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[1] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[1] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = i - 2; x &lt;= i; x++)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; for (y = j - 2; y &lt;= j; y++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; mv[1] += (float)Math.Pow((float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3)) - mi[0], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gg += (float)Math.Pow(b2[x * bmd.Stride + y + 1], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rr += (float)Math.Pow(b2[x * bmd.Stride + y + 2], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mv[1] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bx[0] = bb / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gx[0] = gg / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rx[0] = rr / 9;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //region 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr1 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bb = gg = rr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = 3 * j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; if (ctr == 3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; x = x + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = j - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; mi[2] += (float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[2] += (float)b2[x * bmd.Stride + y];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[2] += (float)b2[x * bmd.Stride + y + 1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[2] += (float)b2[x * bmd.Stride + y + 2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = y + 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ctr1 == 9)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &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; mi[2] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[2] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[2] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[2] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = i - 2; x &lt;= i; x++)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; for (y = j - 2; y &lt;= j; y++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; mv[2] += (float)Math.Pow((float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3)) - mi[0], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gg += (float)Math.Pow(b2[x * bmd.Stride + y + 1], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rr += (float)Math.Pow(b2[x * bmd.Stride + y + 2], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mv[2] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bx[0] = bb / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gx[0] = gg / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rx[0] = rr / 9;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //region 4<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr1 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bb = gg = rr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = j - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; if (ctr == 3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; x = x + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = j - 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; mi[3] += (float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[3] += (float)b2[x * bmd.Stride + y];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[3] += (float)b2[x * bmd.Stride + y + 1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[3] += (float)b2[x * bmd.Stride + y + 2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = y + 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++ctr1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ctr1 == 9)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &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; mi[3] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bm[3] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gm[3] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm[3] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = i - 2; x &lt;= i; x++)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; for (y = j - 2; y &lt;= j; y++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; mv[3] += (float)Math.Pow((float)((float)((float)b2[x * bmd.Stride + y] * 0.11) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.59) + (float)((float)b2[x * bmd.Stride + y + 1] * 0.3)) - mi[0], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gg += (float)Math.Pow(b2[x * bmd.Stride + y + 1], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rr += (float)Math.Pow(b2[x * bmd.Stride + y + 2], 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mv[3] /= 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bx[0] = bb / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //gx[0] = gg / 9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rx[0] = rr / 9;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s = mv[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int h = 1; h &lt;= 3; h++)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; yy = mv[h];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (yy &lt; s)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; s = yy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r = h + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox1.Text = r.ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (r == 1)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; b2[0] = (byte)bm[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &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; else if (r == 2)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; b2[0] = (byte)bm[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &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; else if (r == 3)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; b2[0] = (byte)bm[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &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; else if (r == 4)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; b2[0] = (byte)bm[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &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; //switch (r)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; case 1: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[0] = (byte)bm[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[0] = (byte)bm[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[0] = (byte)bm[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[0] = (byte)bm[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[1] = (byte)gm[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2[2] = (byte)rm[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2 += 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &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; textBox2.Text = j.ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j = j1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox2.Text += j.ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (j &lt;= pictureBox1.Width - 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<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; i = i1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (i &lt;= pictureBox1.Height - 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox1.Text += &quot;HERE. Did not go into next iteration&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bmpd.Save(@&quot;C:\users\pashok\kuwaop.jpg&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bmps.UnlockBits(bms);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bmpd.UnlockBits(bmd);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pictureBox2.Refresh();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pictureBox2.Image = (Image)(new Bitmap(@&quot;C:\users\pashok\kuwaop.jpg&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pictureBox2.Visible = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
The problem I am facing is that this the for loop(i&amp;j) run only once. Inspite of giving break points and verifying, I still am not able to figure out the error. Can someone help me. Its kinda urgent</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sathya8819</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240675.html</guid>
		</item>
		<item>
			<title>Code Snippet Drop-Down TreeView Control (faking it)</title>
			<link>http://www.daniweb.com/code/snippet240597.html</link>
			<pubDate>Mon, 23 Nov 2009 04:33:01 GMT</pubDate>
			<description><![CDATA[*Overview:* 
 
Oddly enough, MS never created a TreeViewDrowDown or equivalent. What I mean, is a control that looks and acts like a ComboBox, but contains a TreeView instead of just a list when in the expanded drop-down mode. I've never understood why they haven't, but I always seem to want to...]]></description>
			<content:encoded><![CDATA[<div><span style="font-weight:bold">Overview:</span><br />
<br />
Oddly enough, MS never created a TreeViewDrowDown or equivalent. What I mean, is a control that looks and acts like a  <pre style="margin:20px; line-height:13px">ComboBox</pre>, but contains a  <pre style="margin:20px; line-height:13px">TreeView</pre> instead of just a list when in the expanded drop-down mode. I've never understood why they haven't, but I always seem to want to incorporate such a control into a design/form. So, a few months ago while working on an application, I decided to create such a control (or rather fake it on a form) in C#.<br />
<br />
In this particular example, I have a pseudo drop-down TreeView control that is intended to drive the contents of the TabControl on the form. However, I did not take the time to demonstrate this activity by populating the TabPages with other controls.:( Let it suffice to say, the &quot;Drop Down TreeView&quot; would drive the rest of the form (TabControl) in this example. In addition, the design and implementation herein is not really a custom control, or a UserControl for that matter, but rather a way to fake the appearance of a TreeViewDropDown control on a Windows Form. Here is a sample (runtime) of the form when the TreeView control is hidden:<br />
<br />
<a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12681&amp;stc=1&amp;d=1258944292" target="_blank">http://www.daniweb.com/forums/attach...1&amp;d=1258944292</a><br />
<br />
And, here is what the control looks like when it is Visible (also at runtime):<br />
<br />
<a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12680&amp;stc=1&amp;d=1258944292" target="_blank">http://www.daniweb.com/forums/attach...1&amp;d=1258944292</a><br />
<br />
The actual controls used to create this effect consist of a TextBox, Button (with down-arrow image), and a TreeView that get's made visible when active and then hidden again when no longer needed (or dropped down).<br />
<br />
<br />
<span style="font-weight:bold">Form's Design View</span><br />
<br />
When viewing the form and controls inside the VS designer, the form appears as this:<br />
<br />
<a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12679&amp;stc=1&amp;d=1258950910" target="_blank">http://www.daniweb.com/forums/attach...1&amp;d=1258950910</a><br />
<br />
With respect to the above designer-view, the little sliver underneath the TextBox and down-arrow Button is actually the TreeView control. The only reason it is visible at all on the form's design is so we can remember it's location and easily select it's properties and events if need be.<br />
<br />
<br />
<span style="font-weight:bold">Runtime Characteristics</span><br />
<br />
Operation at runtime, if not obvious enough, is to have the TreeView control appear (Visible) with a height that is large enough to adequately accommodate the data it contains; and much larger than the sliver seen in the designer. This is accomplished by adjusting the  <pre style="margin:20px; line-height:13px">this.treeView1.Height</pre> when the user clicks the down-arrow Button, which causes the TreeView to become active. We don't need to adjust the width because we have already adjusted that with the Designer.<br />
<br />
When the TreeView becomes active (via drop-down button), we disable the TabControl (via  <pre style="margin:20px; line-height:13px">EnableControls()</pre> method) to prevent user from changing the focus. This is because we want the user to complete the selection (or ESCAPE) since our TreeView is driving the rest of the form. Once the user makes a selection, we call the  <pre style="margin:20px; line-height:13px">SelectionChanged()</pre> method, which then hides the TreeView and performs the necessary update for the rest of the form's controls (sorry, just enabling the TabControl in this case because I didn't actually create a real-world scenario, but I think you'll get the jist).<br />
<br />
<br />
<span style="font-weight:bold">Getting Underneath the Hood:</span><br />
<br />
In the form's constructor, we set the TreeView's  <pre style="margin:20px; line-height:13px">Height</pre> to be something appropriate for the anticipated amount of TreeNodes and for the size of our form. We also  <pre style="margin:20px; line-height:13px">Hide()</pre> the TreeView control at this time because, if you remember, we kept it visible in the Designer.cs view.<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; public Form_TreeViewDropDown()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.Height = 250;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.Hide();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.ReadOnly = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.BackColor = Color.White;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<span style="font-weight:bold"><span style="font-style:italic">IMPORTANT: You may need to modify the Designer.cs file to be sure the  <pre style="margin:20px; line-height:13px">treeView1</pre> control is added to the TOP of the form's Control list or other controls will overlap (hide portions of) the TreeView when it is made visible. Here is an example of the Designer code with the TreeView on top as it should be:<br />
</span></span><br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.treeView1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.tabControl1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.textBox1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.btnDropDownTreeView);</pre><br />
In the form's Load event, we create some TreeView Nodes and force a selection change because the TreeView selection drives our form:<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; private void Form_TreeViewDropDown_Load(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Load the treeView1 here, and select a TreeNode...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Nodes.Add(CreateTreeNodes());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.ExpandAll();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.SelectedNode = treeView1.Nodes&#91;0&#93;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Call the method that processes a change in our treeView's selected node<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
When the user clicks the drop-down button, we either show or hide the TreeView depending on its current state (we toggle the status). If clicked and TreeView is not visible, we make it visible with focus, save the current selection in case of cancel, and disable form controls ( <pre style="margin:20px; line-height:13px">EnableControls()</pre>):<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; private void btnDropDownTreeView_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!treeView1.Visible)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveSelectedNode = treeView1.SelectedNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Visible = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Focus();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EnableControls();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // treeview already visible so toggle it (hide it) and process current selection...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<br />
In our SelectionChanged method, we update the pseudo drop-down treeview's  <pre style="margin:20px; line-height:13px">textBox1.Text</pre> to reflect the currently selected TreeNode, and hide the TreeView control. This is also where we would call any necessary code to update the form's controls (TabControl) to reflect any data lookups pertaining to the selected TreeNode... Finally, we enable controls ( <pre style="margin:20px; line-height:13px">EnableControls()</pre>) to allow user to once again interact with the other controls on the form. Also, notice we have a holder for the currently selected node,  <pre style="margin:20px; line-height:13px">saveSelectedNode</pre>, which is used to restore the selection if the user cancels while the TreeView is active (visible).<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; private void treeView1_SelectionChanged()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode node = treeView1.SelectedNode;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Avoid runtime error if treeView has nothing in it!<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (node != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveSelectedNode = node;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox1.Text = node.Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Hide();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EnableControls();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void treeView1_DoubleClick(object sender, EventArgs e) // Node was selected...<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
To handle ENTER and ESCAPE key presses while (and occurs only when) the TreeView is active:<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; private void treeView1_KeyDown(object sender, KeyEventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode selNode = treeView1.SelectedNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Selection accepted...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (e.KeyCode == Keys.Enter)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.Handled = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Selection canceled...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (e.KeyCode == Keys.Escape)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.SelectedNode = saveSelectedNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.Handled = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
That's it!<br />
<br />
+++++++++++++++++++++++++++++++++++++++++++++++<br />
<br />
Here is the complete Form code:<br />
<br />
 <pre style="margin:20px; line-height:13px">using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace ForumSolutions<br />
{<br />
&nbsp; &nbsp; public partial class Form_TreeViewDropDown : Form<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Used when canceling change made to TreeView.SelectedNode<br />
&nbsp; &nbsp; &nbsp; &nbsp; TreeNode saveSelectedNode;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Form_TreeViewDropDown()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // IMPORTANT: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Be sure the treeView1 control is added to the form's Control list<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // before any controls it will overlap when it is made visible; otherwise,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // the treeView1 control will be cut-off/hidden by the other controls that <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // it is behind (controls that are in front/on top of the treeView1).<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Setting size here because we have it shrunk during design so it doesn't <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // hide our other controls...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.Height = 250;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // The treeview itself is normally hidden unless dropdown button is clicked...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // We could have hidden it in the designer, but then we wouldn't see it when designing...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.Hide();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // We want to capture the ENTER and ESCAPE keys...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //this.treeView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeView1_KeyDown);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // The textbox for our selected node is read only, but we want the background<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // color to be white instead of the read only gray color...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.ReadOnly = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.BackColor = Color.White;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void Form_TreeViewDropDown_Load(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Load the treeView1 here, and select a TreeNode...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Nodes.Add(CreateTreeNodes());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.ExpandAll();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.SelectedNode = treeView1.Nodes&#91;0&#93;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Call the method that processes a change in our treeView's selected node<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private TreeNode CreateTreeNodes()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode topNode = new TreeNode(&quot;TopNode&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int order = 0;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; 5; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode iNode = new TreeNode(&quot;Hey, I'm a grandparent! Order: &quot; + order++);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; topNode.Nodes.Add(iNode);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int ii = 0; ii &lt; 5; ii++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode iiNode = new TreeNode(&quot;Hey, I'm the parent! Order: &quot; + order++);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; topNode.Nodes&#91;i&#93;.Nodes.Add(iiNode);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int iii = 0; iii &lt; 5; iii++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode iiiNode = new TreeNode(&quot;Yeah, I'm just a child (leaf)! Order: &quot; + order++);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; topNode.Nodes&#91;i&#93;.Nodes&#91;ii&#93;.Nodes.Add(iiiNode);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return topNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void treeView1_SelectionChanged() // NOTE: This method is not directly wired to any event...<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode node = treeView1.SelectedNode;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Avoid runtime error if treeView has nothing in it!<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (node != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveSelectedNode = node; // save the selected node for any future cancel operations...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox1.Text = node.Text; // update our textbox for the simulated drop down control...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Hide the treeview control because any time this method is called,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // it means an item (TreeNode) was accepted (double clicked, etc.) and selected...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Hide();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Enable form's controls...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EnableControls();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void treeView1_DoubleClick(object sender, EventArgs e) // Node was selected...<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void btnDropDownTreeView_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If treeview is not visible then do the drop down (make it visible)...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!treeView1.Visible)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveSelectedNode = treeView1.SelectedNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Visible = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.Focus();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Disable TabControl until user makes or cancels selection...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EnableControls();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // treeview already visible so toggle it (hide it) and process current selection...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void EnableControls()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (treeView1.Visible)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tabControl1.Enabled = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tabControl1.Enabled = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void treeView1_KeyDown(object sender, KeyEventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode selNode = treeView1.SelectedNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Selection accepted...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (e.KeyCode == Keys.Enter)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.Handled = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Selection canceled...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (e.KeyCode == Keys.Escape)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1.SelectedNode = saveSelectedNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; treeView1_SelectionChanged();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.Handled = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre><br />
And, in the designer.cs file:<br />
<br />
 <pre style="margin:20px; line-height:13px">namespace ForumSolutions<br />
{<br />
&nbsp; &nbsp; partial class Form_TreeViewDropDown<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Required designer variable.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private System.ComponentModel.IContainer components = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Clean up any resources being used.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;param name=&quot;disposing&quot;&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected override void Dispose(bool disposing)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (disposing &amp;&amp; (components != null))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; components.Dispose();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; base.Dispose(disposing);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; #region Windows Form Designer generated code<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Required method for Designer support - do not modify<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// the contents of this method with the code editor.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void InitializeComponent()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_TreeViewDropDown));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1 = new System.Windows.Forms.TextBox();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView = new System.Windows.Forms.Button();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1 = new System.Windows.Forms.TreeView();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1 = new System.Windows.Forms.TabControl();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1 = new System.Windows.Forms.TabPage();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2 = new System.Windows.Forms.TabPage();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.SuspendLayout();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.SuspendLayout();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // textBox1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.Location = new System.Drawing.Point(16, 20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.Name = &quot;textBox1&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.ReadOnly = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.Size = new System.Drawing.Size(329, 20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.textBox1.TabIndex = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // btnDropDownTreeView<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView.Image = ((System.Drawing.Image)(resources.GetObject(&quot;btnDropDownTreeView.Image&quot;)));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView.Location = new System.Drawing.Point(344, 20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView.Name = &quot;btnDropDownTreeView&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView.Size = new System.Drawing.Size(20, 20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView.TabIndex = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView.UseVisualStyleBackColor = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.btnDropDownTreeView.Click += new System.EventHandler(this.btnDropDownTreeView_Click);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // treeView1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.Location = new System.Drawing.Point(16, 39);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.Name = &quot;treeView1&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.Size = new System.Drawing.Size(348, 11);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.TabIndex = 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.DoubleClick += new System.EventHandler(this.treeView1_DoubleClick);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.treeView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeView1_KeyDown);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // tabControl1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.Controls.Add(this.tabPage1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.Controls.Add(this.tabPage2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.Location = new System.Drawing.Point(16, 71);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.Name = &quot;tabControl1&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.SelectedIndex = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.Size = new System.Drawing.Size(619, 260);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.TabIndex = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // tabPage1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1.Location = new System.Drawing.Point(4, 22);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1.Name = &quot;tabPage1&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1.Padding = new System.Windows.Forms.Padding(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1.Size = new System.Drawing.Size(611, 234);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1.TabIndex = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1.Text = &quot;tabPage1&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage1.UseVisualStyleBackColor = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // tabPage2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2.Location = new System.Drawing.Point(4, 22);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2.Name = &quot;tabPage2&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2.Padding = new System.Windows.Forms.Padding(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2.Size = new System.Drawing.Size(611, 234);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2.TabIndex = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2.Text = &quot;tabPage2&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabPage2.UseVisualStyleBackColor = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Form_TreeViewDropDown<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.ClientSize = new System.Drawing.Size(647, 354);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.treeView1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.tabControl1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.textBox1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Controls.Add(this.btnDropDownTreeView);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Name = &quot;Form_TreeViewDropDown&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Text = &quot;Form_TreeViewDropDown&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Load += new System.EventHandler(this.Form_TreeViewDropDown_Load);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.tabControl1.ResumeLayout(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.ResumeLayout(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.PerformLayout();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; #endregion<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private System.Windows.Forms.TextBox textBox1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private System.Windows.Forms.Button btnDropDownTreeView;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private System.Windows.Forms.TreeView treeView1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private System.Windows.Forms.TabControl tabControl1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private System.Windows.Forms.TabPage tabPage1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private System.Windows.Forms.TabPage tabPage2;<br />
&nbsp; &nbsp; }<br />
}</pre></div>  <br /> <div style="padding:5px">    <fieldset class="fieldset"> <legend>Attached Images</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/png.gif" alt="File Type: png" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12679&amp;d=1258944251" target="_blank">TreeViewDropDown Figure 0.PNG</a> (14.6 KB)</td> </tr><tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/png.gif" alt="File Type: png" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12680&amp;d=1258944270" target="_blank">TreeViewDropDown Figure 1.PNG</a> (25.9 KB)</td> </tr><tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/png.gif" alt="File Type: png" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12681&amp;d=1258944288" target="_blank">TreeViewDropDown Figure 2.PNG</a> (13.7 KB)</td> </tr><tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/gif.gif" alt="File Type: gif" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12684&amp;d=1258950705" target="_blank">arrow_down.gif</a> (195 Bytes)</td> </tr> </table> </fieldset>   </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>DdoubleD</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240597.html</guid>
		</item>
		<item>
			<title>Mysql database backup and restore using mysql.data.client</title>
			<link>http://www.daniweb.com/forums/thread240576.html</link>
			<pubDate>Mon, 23 Nov 2009 04:09:30 GMT</pubDate>
			<description>Hi everybody 
I have been developing windows client application in .net framework 3.5. The system is supposed to copy the remote mysqldb and restore my local mysqldb with all the schema and data withing remote schema to my local mysqldb with the same database name. 
 
Well i found a solution to...</description>
			<content:encoded><![CDATA[<div>Hi everybody<br />
I have been developing windows client application in .net framework 3.5. The system is supposed to copy the remote mysqldb and restore my local mysqldb with all the schema and data withing remote schema to my local mysqldb with the same database name.<br />
<br />
Well i found a solution to this using a mysqldump command and executing it from .net by writing all the necessary command in a bat file and executing the bat file by invoking from .net.<br />
<br />
But i was looking for a better solution.<br />
<br />
The way we make a sqlserver db backup and restore usig SqlServer.Smo package in .net<br />
<br />
<br />
I there any way to make a database backup and restore using mysql.data.client. or just copy my remote mysql database to my local mysql database. all using mysql.data.client.<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>nccsbim071</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240576.html</guid>
		</item>
		<item>
			<title>Help needed testing a patch</title>
			<link>http://www.daniweb.com/forums/thread240563.html</link>
			<pubDate>Mon, 23 Nov 2009 02:52:44 GMT</pubDate>
			<description>When I installed windows 7 I opted to do a fresh clean install, but the key I purchased was an upgrade key and required that I performed an upgrade. The disk itself was bootable so I performed a clean install and modified some registry keys and ran a vb script in the system32 folder and this...</description>
			<content:encoded><![CDATA[<div>When I installed windows 7 I opted to do a fresh clean install, but the key I purchased was an upgrade key and required that I performed an upgrade. The disk itself was bootable so I performed a clean install and modified some registry keys and ran a vb script in the system32 folder and this enabled me to enter my upgrade key to activate window even though the system knew I performed a clean install.<br />
<br />
This isn't illegal, Its just a workaround. Since I had a legal copy of windows to upgrade from, I didn't break the EULA. I decided to automate this by writing a little application that applies the patch automatically. I am 90% sure it works, but I can't test it. So if anyone out there is about to install windows 7 with a clean install from an upgrade key. Please try out my patch and tell me if it works!<br />
<br />
Thanks.</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/zip.gif" alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12683&amp;d=1258944741">win7UpgradeKeyEnabler.zip</a> (19.3 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240563.html</guid>
		</item>
		<item>
			<title>Should I change to C# or stay with C++?</title>
			<link>http://www.daniweb.com/forums/thread240561.html</link>
			<pubDate>Mon, 23 Nov 2009 02:50:41 GMT</pubDate>
			<description>Ok...i know a little bit of C++ (basics, like cout, cin, a little bit of classes ect) and realized something after watching a video from Chris Pirrilo... 
 
 
I dived into C++ without researching other languages first. My question to you is...should i stay w/ C++ or switch to C#? Can you give me...</description>
			<content:encoded><![CDATA[<div>Ok...i know a little bit of C++ (basics, like cout, cin, a little bit of classes ect) and realized something after watching a video from Chris Pirrilo...<br />
<br />
<br />
I dived into C++ without researching other languages first. My question to you is...should i stay w/ C++ or switch to C#? Can you give me some pros and cons of each language? What do you prefer? Do you recommend another language besides C++/C#?<br />
<br />
<br />
Thank you,<br />
EpicAsian</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>epicasian</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240561.html</guid>
		</item>
		<item>
			<title>Active Directory Properties</title>
			<link>http://www.daniweb.com/forums/thread240539.html</link>
			<pubDate>Mon, 23 Nov 2009 00:37:57 GMT</pubDate>
			<description><![CDATA[Hi guys, 
with help I've figured out how to set the "user cannot change password" using the code below. I'm now trying to figure out how to remove the property. I thought setting the denied flag to "allow" would work but it seems to do nothing. I would like the code to be using DirectoryEntry and...]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
with help I've figured out how to set the &quot;user cannot change password&quot; using the code below. I'm now trying to figure out how to remove the property. I thought setting the denied flag to &quot;allow&quot; would work but it seems to do nothing. I would like the code to be using DirectoryEntry and not PrincipalContext if possible as I'm not sure if my app will be using .NET 3.5 on all the servers. Any help on this would be greatly appreciated.<br />
<br />
 <pre style="margin:20px; line-height:13px">string PASSWORD_GUID = &quot;{ab721a53-1e2f-11d0-9819-00aa0040529b}&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string [] trustees = {&quot;NT AUTHORITY\\SELF&quot;, &quot;EVERYONE&quot;};<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActiveDs.IADsSecurityDescriptor sd = (ActiveDs.IADsSecurityDescriptor)User.Properties[&quot;ntSecurityDescriptor&quot;].Value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActiveDs.IADsAccessControlList acl = (ActiveDs.IADsAccessControlList) sd.DiscretionaryAcl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActiveDs.AccessControlEntry ace = new ActiveDs.AccessControlEntry();&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double denied = (double)ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_DENIED_OBJECT;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double objectType = (double)ActiveDs.ADS_FLAGTYPE_ENUM.ADS_FLAG_OBJECT_TYPE_PRESENT;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dsControl = (double)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_DS_CONTROL_ACCESS;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (string trustee in trustees) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ace.Trustee = trustee;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ace.AceFlags = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ace.AceType = Convert.ToInt32(Math.Floor(denied));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ace.Flags = Convert.ToInt32(Math.Floor(objectType));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ace.ObjectType = PASSWORD_GUID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ace.AccessMask = Convert.ToInt32(Math.Floor(dsControl));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; acl.AddAce(ace);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sd.DiscretionaryAcl = acl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; User.Properties[&quot;ntSecurityDescriptor&quot;].Value = sd;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; User.CommitChanges();</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>luketongs</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240539.html</guid>
		</item>
		<item>
			<title>Value available in child form</title>
			<link>http://www.daniweb.com/forums/thread240467.html</link>
			<pubDate>Sun, 22 Nov 2009 16:06:00 GMT</pubDate>
			<description>Hello again! 
 
I have a form (Form1) with some textbox, call it textbox1. With a button event I open a second form and hide de Form1. In this Form2 I dont use the value, I just make other things.. then open a another form, Form3 here I want to use the value from Form1. 
 
I read that turn on...</description>
			<content:encoded><![CDATA[<div>Hello again!<br />
<br />
I have a form (Form1) with some textbox, call it textbox1. With a button event I open a second form and hide de Form1. In this Form2 I dont use the value, I just make other things.. then open a another form, Form3 here I want to use the value from Form1.<br />
<br />
I read that turn on public textbox is wrong, then I try to use get set method:<br />
<br />
In Form1:<br />
<br />
 <pre style="margin:20px; line-height:13px">public string getvalue0<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  get { return textBox1.Text.ToString(); }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<br />
In Form3:<br />
 <pre style="margin:20px; line-height:13px">public string getvalue1<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  set { textBox1.Text = value; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
I know that I need to use something like this:<br />
 <pre style="margin:20px; line-height:13px">Form3 form3 = new Form3();<br />
form3.getvalue1 = getvalue0;</pre><br />
But how? If I use this in Form2:<br />
<br />
 <pre style="margin:20px; line-height:13px">Form3 form3 = new Form3();<br />
form3.Show();<br />
this.Close();</pre><br />
<br />
Thanks a lot.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>chromatinpt</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240467.html</guid>
		</item>
		<item>
			<title>How to  show and print  my datalogger data?</title>
			<link>http://www.daniweb.com/forums/thread240444.html</link>
			<pubDate>Sun, 22 Nov 2009 13:41:34 GMT</pubDate>
			<description>Hello 
 
I am creating the windows application for reading, calculating and printing the data logged by my USB device in c#.  I am basically a Microcontroller programmer but now learning C#.  
I have already succeeded in collecting data from my system via USB (Code from Jan Axelson...</description>
			<content:encoded><![CDATA[<div>Hello<br />
<br />
I am creating the windows application for reading, calculating and printing the data logged by my USB device in c#.  I am basically a Microcontroller programmer but now learning C#. <br />
I have already succeeded in collecting data from my system via USB (Code from <a rel="nofollow" class="t" href="http://lvr.com/" target="_blank">Jan Axelson</a>) and created graphs of data using <a rel="nofollow" class="t" href="http://zedgraph.org/wiki/index.php?title=Main_Page" target="_blank">ZedGraph</a>. The basic setup is in place.<br />
<br />
Now my requirement is that I have to prepare the data in a table form, make some calculations , make some results and show all these neatly in a form and print if needed. Even though i have different data sets, a single set can anyway accommodate in a A4 size sheet.<br />
What should I look for ? Is it what we call report writer?<br />
How should I proceed?<br />
<br />
Thanks for reading<br />
Roy Thomas</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>RoyMicro</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240444.html</guid>
		</item>
		<item>
			<title>C# windows service with database connection</title>
			<link>http://www.daniweb.com/forums/thread240443.html</link>
			<pubDate>Sun, 22 Nov 2009 13:28:02 GMT</pubDate>
			<description><![CDATA[I'm trying to write a Windows service in Visual Studio 2008. The service is supposed to update an Access database. I've created a Windows service project and added an Access database to the project. A data source has been created that contains all tables from the database. Now to my problem. How do...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to write a Windows service in Visual Studio 2008. The service is supposed to update an Access database. I've created a Windows service project and added an Access database to the project. A data source has been created that contains all tables from the database. Now to my problem. How do I &quot;auto create&quot; table adapters and bindingsource objects when the project is a service project? It's not possible to drop tables from the data source view in to the designer view of the service (like in a WinForms project)<br />
<br />
Thanks in advance<br />
Tommy</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>tpetter1</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240443.html</guid>
		</item>
		<item>
			<title>Business logic layer</title>
			<link>http://www.daniweb.com/forums/thread240436.html</link>
			<pubDate>Sun, 22 Nov 2009 13:00:43 GMT</pubDate>
			<description>I am learing programming for a bit more then 6 months, and recently someone told me my concept is not the best one, he proposed me that I rather split my code into business logic layer and data access layer. 
 
And now I would like to ask someone if he can help me out on a simple example of how to...</description>
			<content:encoded><![CDATA[<div>I am learing programming for a bit more then 6 months, and recently someone told me my concept is not the best one, he proposed me that I rather split my code into business logic layer and data access layer.<br />
<br />
And now I would like to ask someone if he can help me out on a simple example of how to do business logic for this example (it`s about library):<br />
<br />
Database tables(Parameters):<br />
<br />
1. Author (IDAuthor, Name, SureName)<br />
2. Book (IDBook, IDAuthorFK, Title)<br />
<br />
I would like to have methods:<br />
1.1. Get author name and surename<br />
1.2. Add new author (insert)<br />
1.3. Update author<br />
1.4. Delete author<br />
<br />
2.1 Get books (returns all books)<br />
2.2. Get book by author`s ID (returns a value by author`s ID)<br />
2.3. Add new book<br />
2.4. Update book<br />
2.5. Delete book</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240436.html</guid>
		</item>
		<item>
			<title>Is C# and WPF a good choice?</title>
			<link>http://www.daniweb.com/forums/thread240408.html</link>
			<pubDate>Sun, 22 Nov 2009 10:55:17 GMT</pubDate>
			<description><![CDATA[Dear forum members, 
 
I'm working on an accounting software, which I was planing to do using C#. Now that I see there is WPF that I can use instead of WinForms, I would like to ask you a couple of questions. 
 
1. For an account software, which I would like to have it looking good, with dynamic...]]></description>
			<content:encoded><![CDATA[<div>Dear forum members,<br />
<br />
I'm working on an accounting software, which I was planing to do using C#. Now that I see there is WPF that I can use instead of WinForms, I would like to ask you a couple of questions.<br />
<ol style="list-style-type: decimal"><li>For an account software, which I would like to have it looking good, with dynamic graphs and &quot;easy on eyes&quot; with light animations (like apps on iphone, transitions etc), is C# .NET WPF a good choice? What would be your recommendations?<br /></li>
<li>And how can I skin the window completely? Like, iTunes working on a Windows machine. The window and the title bar is custom, but buttons for quitting the application or minimizing it still the Windows one. How can I do this with VS and C# with WPF?<br /></li>
<li>Once the project is complete, can I deploy it to work on a web browser? Is it possible? Because I read some stuff like this.<br /></li>
<li>what is it that I can do with C# and WPF that can't be done with Silverlight?<br />
</li>
</ol><br />
Also, dear members, do you have any favorite resource which teaches animation and design side of WPF?<br />
<br />
Thank you very much.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>mr.white</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240408.html</guid>
		</item>
		<item>
			<title><![CDATA[How to keep a form not 'accesable' ?]]></title>
			<link>http://www.daniweb.com/forums/thread240399.html</link>
			<pubDate>Sun, 22 Nov 2009 09:21:49 GMT</pubDate>
			<description><![CDATA[Hai 
 
      May be too simple but I was not able to locate info on this.. 
 
My main form will have a button, when I click on it another form should appear. I can do it. I need the parent form there( no .hide) but it should not be 'click-able'. It can be click-able only after the new form is...]]></description>
			<content:encoded><![CDATA[<div>Hai<br />
<br />
      May be too simple but I was not able to locate info on this..<br />
<br />
My main form will have a button, when I click on it another form should appear. I can do it. I need the parent form there( no .hide) but it should not be 'click-able'. It can be click-able only after the new form is closed. I did the hiding and restoring (an example in forum) on new form close. But I need to do this without hiding. Is it possible?<br />
<br />
Please<br />
<br />
Thank you<br />
Roy Thomas</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>RoyMicro</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240399.html</guid>
		</item>
		<item>
			<title>How to do calculations using ComboBox?</title>
			<link>http://www.daniweb.com/forums/thread240387.html</link>
			<pubDate>Sun, 22 Nov 2009 07:19:21 GMT</pubDate>
			<description><![CDATA[Hello I am doing calculation using comboxBox...But it is not doing correctly 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>Hello I am doing calculation using comboxBox...But it is not doing correctly<br />
<br />
 <pre style="margin:20px; line-height:13px">a = int.Parse(textBox1.Text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b = int.Parse(textBox2.Text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (comboBox1.Text == &quot;*&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c = a * b;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox3.Text = c.ToString();</pre><br />
Any help here can point out where problem is ?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>th3learner</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240387.html</guid>
		</item>
		<item>
			<title>C# Null references just love me....</title>
			<link>http://www.daniweb.com/forums/thread240382.html</link>
			<pubDate>Sun, 22 Nov 2009 06:12:27 GMT</pubDate>
			<description><![CDATA[I got it when trying to initialize my array of sprites 
(( the only one trowing me null is the sprite2D[] AllianceCharacters 
 
 
declaration: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I got it when trying to initialize my array of sprites<br />
(( the only one trowing me null is the sprite2D[] AllianceCharacters<br />
<br />
<br />
declaration:<br />
 <pre style="margin:20px; line-height:13px">sprite2D[] AllianceCharacters;<br />
static string Cardspath = Directory.GetCurrentDirectory() + &quot;\\Content\\Cards&quot;;<br />
string[] ActionBar = Directory.GetFiles(Cardspath + &quot;\\ActionBar\\&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; string[] Equips = Directory.GetFiles(Cardspath + &quot;\\ActionBar\\Equips&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; string[] CharactersAlliance = Directory.GetFiles(Cardspath + &quot;\\Characters\\Alliance\\&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; string[] CharactersHorde = Directory.GetFiles(Cardspath + &quot;\\Characters\\Horde\\&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; string[] CharactersMonster = Directory.GetFiles(Cardspath + &quot;\\Characters\\Monster\\&quot;);</pre>initialization:<br />
 <pre style="margin:20px; line-height:13px">for (int i = 0; i &lt; CharactersAlliance.Length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllianceCharacters[i] = new sprite2D(Content.Load&lt;Texture2D&gt;(Cardspath + &quot;\\Characters\\Alliance\\&quot; + CharactersAlliance[i]));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllianceCharacters[i].name = CharactersAlliance[i];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<br />
//This is called at the beginning::<br />
 <pre style="margin:20px; line-height:13px">void FixNames()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x, y, z, a, h, m;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = Equips.Length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z = ActionBar.Length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a = CharactersAlliance.Length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; h = CharactersHorde.Length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m = CharactersMonster.Length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char[] xnb = { 'b', 'n', 'x', '.' };<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = 0; x &lt; y; x++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Equips[x] = Path.GetFileName(Equips[x]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Equips[x] = Equips[x].TrimEnd(xnb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = 0; x &lt; z; x++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActionBar[x] = Path.GetFileName(ActionBar[x]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActionBar[x] = ActionBar[x].TrimEnd(xnb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = 0; x &lt; a; x++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharactersAlliance[x] = Path.GetFileName(CharactersAlliance[x]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharactersAlliance[x] = CharactersAlliance[x].TrimEnd(xnb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = 0; x &lt; h; x++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharactersHorde[x] = Path.GetFileName(CharactersHorde[x]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharactersHorde[x] = CharactersHorde[x].TrimEnd(xnb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = 0; x &lt; m; x++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharactersMonster[x] = Path.GetFileName(CharactersMonster[x]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharactersMonster[x] = CharactersMonster[x].TrimEnd(xnb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<br />
any idea on what could be making it fail ?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>gogodr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240382.html</guid>
		</item>
		<item>
			<title>controls in 3rd form</title>
			<link>http://www.daniweb.com/forums/thread240317.html</link>
			<pubDate>Sat, 21 Nov 2009 22:45:37 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I have some app like this: 
 
Form1 (Parent) -> open in load event a Form2 (child) which have a button that open a 3rd one child form (then close Form2). 
 
My question is how I can access a control property (like labeltext (in statusbar) in Form1)?  
 
Form1 Parent 
  <div...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have some app like this:<br />
<br />
Form1 (Parent) -&gt; open in load event a Form2 (child) which have a button that open a 3rd one child form (then close Form2).<br />
<br />
My question is how I can access a control property (like labeltext (in statusbar) in Form1)? <br />
<br />
Form1 Parent<br />
 <pre style="margin:20px; line-height:13px"> private void Form1_Load(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Form2 chForm2 = new Form2();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chForm2.MdiParent = this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chForm2.Show();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  }</pre><br />
Form2 Child<br />
 <pre style="margin:20px; line-height:13px">Button click event<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Form3 chForm3 = new Form3();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chForm3.MdiParent = Form1.ActiveForm;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chForm3.Show();</pre><br />
Now in Form1 I have a labeltext in statusbar that I want to control from Form3.<br />
<br />
Thanks a lot!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>chromatinpt</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240317.html</guid>
		</item>
		<item>
			<title>null exception on Arithmetic operation</title>
			<link>http://www.daniweb.com/forums/thread240210.html</link>
			<pubDate>Sat, 21 Nov 2009 10:22:33 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I'm having exception on this line, when some of the textboxes do not have value in 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I'm having exception on this line, when some of the textboxes do not have value in<br />
 <pre style="margin:20px; line-height:13px">if (Convert.ToInt32(LeaveDay.Text) + Convert.ToInt32(SickDay.Text) + Convert.ToInt32(WorkDay.Text) &gt; limitDay)</pre><br />
appreciate any help<br />
thanks<br />
snky</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>snakay</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240210.html</guid>
		</item>
		<item>
			<title>Custom event</title>
			<link>http://www.daniweb.com/forums/thread240200.html</link>
			<pubDate>Sat, 21 Nov 2009 09:23:05 GMT</pubDate>
			<description>Hi, 
 
using old pure C, I was able to define a custom windows message. Once done, it was possible to broadcast the message across my application. Any object, with defined listener was able to receive and process the message. OK, right now, I need to do the same in C#. I have a class (let’s call it...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
using old pure C, I was able to define a custom windows message. Once done, it was possible to broadcast the message across my application. Any object, with defined listener was able to receive and process the message. OK, right now, I need to do the same in C#. I have a class (let’s call it ABC), which should broadcast a message in case something happens. The application has multiple forms (some of the are active, some of them not - that’s why I need general broadcast message/event instead of call a specific method). In case, something happens (e.g. ABC finishes some calculation), I want ABC to send a broadcast message (by broadcast I mean, the ABC class doesn’t know, who will receive it). The message will be processed by all active forms with defined listener. Please, could you let me know, how to send the message and how to define the listeners?<br />
<br />
Marek</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>mstrop</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240200.html</guid>
		</item>
		<item>
			<title>show full path in title bar</title>
			<link>http://www.daniweb.com/forums/thread240182.html</link>
			<pubDate>Sat, 21 Nov 2009 07:33:44 GMT</pubDate>
			<description><![CDATA[hi again every one ... 
in my computer , 
tools -> folder option ... we can select check box like show full path in address bar or show full path in titlebar. 
 
that same thing i want to do it through code or thorugh API?? 
 
how can i achieve this in C#?? 
 
can set any parameter or call any api...]]></description>
			<content:encoded><![CDATA[<div>hi again every one ...<br />
in my computer ,<br />
tools -&gt; folder option ... we can select check box like show full path in address bar or show full path in titlebar.<br />
<br />
that same thing i want to do it through code or thorugh API??<br />
<br />
how can i achieve this in C#??<br />
<br />
can set any parameter or call any api to show full path in title bar or can get path from address bar through code??<br />
<br />
any help please ...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>crazyboy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240182.html</guid>
		</item>
		<item>
			<title>Keep track of deletion and creation of file.</title>
			<link>http://www.daniweb.com/forums/thread240158.html</link>
			<pubDate>Sat, 21 Nov 2009 04:57:46 GMT</pubDate>
			<description>hi friends ... 
i want help regarding file management in windows. 
 
what i want to do is , 
Keep track of all files and folders created or deleted during a period of time. 
 
for example , 
during 5 to 6 pm somebudy else is using my computer. so at that time  
i want to track whatever action...</description>
			<content:encoded><![CDATA[<div>hi friends ...<br />
i want help regarding file management in windows.<br />
<br />
what i want to do is ,<br />
Keep track of all files and folders created or deleted during a period of time.<br />
<br />
for example ,<br />
during 5 to 6 pm somebudy else is using my computer. so at that time <br />
i want to track whatever action performed by that user reagarding files like deletion of some file or creation of some files etc.<br />
<br />
i have done a lot googling but not ot any solution.<br />
i also tried to get through system message queue.but still i m not getting wht i want.<br />
<br />
any one knows how can i achieve this??<br />
i just want to track that creation and deletion of file in database.<br />
<br />
or<br />
<br />
any one knows wht actually happen in system when user create any file or delete any file.i mean wht apis are call wht processes are called??</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>crazyboy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240158.html</guid>
		</item>
		<item>
			<title>Parent and Childs, menustrip</title>
			<link>http://www.daniweb.com/forums/thread240071.html</link>
			<pubDate>Fri, 20 Nov 2009 19:45:53 GMT</pubDate>
			<description>Hello! 
 
I have one main form (parent) which contains others child forms. The first child form is a login form, that after correct autentication opens another child form.  
 
Depending on the user (operator or supervisor) some items of menustrip in form Parent should be available or not. The...</description>
			<content:encoded><![CDATA[<div>Hello!<br />
<br />
I have one main form (parent) which contains others child forms. The first child form is a login form, that after correct autentication opens another child form. <br />
<br />
Depending on the user (operator or supervisor) some items of menustrip in form Parent should be available or not. The supervisor will have full menu available, the user only some items.<br />
<br />
How can I do that? Any ideias?<br />
<br />
Thanks a lot.<br />
Tiago</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>chromatinpt</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240071.html</guid>
		</item>
		<item>
			<title>Check if record exists in MSA using C#</title>
			<link>http://www.daniweb.com/forums/thread240067.html</link>
			<pubDate>Fri, 20 Nov 2009 19:02:26 GMT</pubDate>
			<description><![CDATA[Hi, 
 
No excuses: my problem is that I can't get my code to check if a certain record exists in a MSA database. 
 
My code needs to check if the database contains a row where 2, 3 or 4 specified fields exist.  
But, as mentioned, at the moment it only gives errors about missing parameters. ...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
No excuses: my problem is that I can't get my code to check if a certain record exists in a MSA database.<br />
<br />
My code needs to check if the database contains a row where 2, 3 or 4 specified fields exist. <br />
But, as mentioned, at the moment it only gives errors about missing parameters. <br />
Before I post the code I'd like to know what the correct way is, as the code is very secret :).</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Calaesto</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240067.html</guid>
		</item>
		<item>
			<title>Sending data to e-mail</title>
			<link>http://www.daniweb.com/forums/thread240054.html</link>
			<pubDate>Fri, 20 Nov 2009 17:55:38 GMT</pubDate>
			<description>I have 3 textboxes..textBox1,textBox2,textBox3.I want that when user clicks on submit button all data should go to e-mail address.. 
 
Any one here can please help me to get through code? 
 
Thanks very much</description>
			<content:encoded><![CDATA[<div>I have 3 textboxes..textBox1,textBox2,textBox3.I want that when user clicks on submit button all data should go to e-mail address..<br />
<br />
Any one here can please help me to get through code?<br />
<br />
Thanks very much</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>th3learner</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240054.html</guid>
		</item>
		<item>
			<title><![CDATA[How to do a "Publish Application" correctly]]></title>
			<link>http://www.daniweb.com/forums/thread240046.html</link>
			<pubDate>Fri, 20 Nov 2009 16:57:44 GMT</pubDate>
			<description>I`ve done an application and I then I published it. That did a setup.exe file. 
If I want to install it on my pc its all ok, but if I want to install it on some other pc, there is an error. It`s still lookingfor the path I have the application.  
There are some problems with the database. It looks...</description>
			<content:encoded><![CDATA[<div>I`ve done an application and I then I published it. That did a setup.exe file.<br />
If I want to install it on my pc its all ok, but if I want to install it on some other pc, there is an error. It`s still lookingfor the path I have the application. <br />
There are some problems with the database. It looks like there is no BD attached into installer.<br />
<br />
<a rel="nofollow" class="t" href="http://www.file.si/files/rsp2pex03sxhgvfclmi5.jpg" target="_blank">PICTURE</a>.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240046.html</guid>
		</item>
		<item>
			<title>dll not found when changing the path</title>
			<link>http://www.daniweb.com/forums/thread240033.html</link>
			<pubDate>Fri, 20 Nov 2009 15:14:30 GMT</pubDate>
			<description><![CDATA[Hi everyone, sorry about my english. Im having a problem and i don't know how to fix it. 
 
I have a plugin-based application that i'm developing. Every plugin has a reference to a dll that has different static classes with functions. When i run the application with all the dlls (plugins and their...]]></description>
			<content:encoded><![CDATA[<div>Hi everyone, sorry about my english. Im having a problem and i don't know how to fix it.<br />
<br />
I have a plugin-based application that i'm developing. Every plugin has a reference to a dll that has different static classes with functions. When i run the application with all the dlls (plugins and their references) in the same directory, the application works fine. But the problem comes when i change the application's path, leaving the dlls in other path. When i run the application, the plugin dll thrown an exception saying that the &quot;functions dll&quot; could not be found, but the dll is in the same directory as the plugin :| .<br />
<br />
If i don't explain well:<br />
<span style="color:Green">C:\app.exe<br />
C:\plugin.dll<br />
C:\functions.dll</span><br />
It works fine.<br />
<br />
<span style="color:Red">C:\test\app.exe<br />
C:\plugin.dll<br />
C:\functions.dll</span><br />
It doesn't work.<br />
<br />
I don't know where is the problem.<br />
I'll be really grateful for your help.<br />
<br />
Thanks<br />
Greetings</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>tincho87</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240033.html</guid>
		</item>
		<item>
			<title>Call some code when press some key ?</title>
			<link>http://www.daniweb.com/forums/thread240021.html</link>
			<pubDate>Fri, 20 Nov 2009 14:21:28 GMT</pubDate>
			<description><![CDATA[Hi, 
i would like that when pressing the key example "M" to call some code. Same as Ctrl+Alt+Delete and TaskManager but in my case i have process in background which maybe can be used for this?]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
i would like that when pressing the key example &quot;M&quot; to call some code. Same as Ctrl+Alt+Delete and TaskManager but in my case i have process in background which maybe can be used for this?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Dum_</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240021.html</guid>
		</item>
		<item>
			<title>displaying the image stored in the database in bigger size but in original dimension</title>
			<link>http://www.daniweb.com/forums/thread240019.html</link>
			<pubDate>Fri, 20 Nov 2009 14:02:39 GMT</pubDate>
			<description><![CDATA[<asp:Image ID="imgpdet" runat="server"  Height = 350"                 Width="350"/> 
 
I want to assign the height and width of the image which is the same of the original image from database . 
 
Actual problem is i have an horizontal and vertical photos , if i give height matching the horizontal...]]></description>
			<content:encoded><![CDATA[<div>&lt;asp:Image ID=&quot;imgpdet&quot; runat=&quot;server&quot;  Height = 350&quot;                 Width=&quot;350&quot;/&gt;<br />
<br />
I want to assign the height and width of the image which is the same of the original image from database .<br />
<br />
Actual problem is i have an horizontal and vertical photos , if i give height matching the horizontal photo the vertical photo will be displayed in expanded format.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>coollife</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240019.html</guid>
		</item>
		<item>
			<title>c# Video Editing.</title>
			<link>http://www.daniweb.com/forums/thread240012.html</link>
			<pubDate>Fri, 20 Nov 2009 13:10:45 GMT</pubDate>
			<description>hi to all, 
I have design a Application that takes input  
 
from the Web cam or other video devices. and  
 
have to add some frames in the Live video and  
 
then display.  
i have study out the direct sdk , which</description>
			<content:encoded><![CDATA[<div>hi to all,<br />
I have design a Application that takes input <br />
<br />
from the Web cam or other video devices. and <br />
<br />
have to add some frames in the Live video and <br />
<br />
then display. <br />
i have study out the direct sdk , which <br />
<br />
provide the flexible enviornment. but i dont <br />
<br />
get the proper flow.It is totaly based on the <br />
<br />
VC++ component.<br />
Please Help.<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>pkuchaliya</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240012.html</guid>
		</item>
		<item>
			<title>Kuwahara Filter</title>
			<link>http://www.daniweb.com/forums/thread240006.html</link>
			<pubDate>Fri, 20 Nov 2009 12:41:33 GMT</pubDate>
			<description><![CDATA[I am trying to implement the Kuwahara Filter in C#. I think my code is right, but I am not getting an exact output. Can someone help me with where I am going wrong? 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I am trying to implement the Kuwahara Filter in C#. I think my code is right, but I am not getting an exact output. Can someone help me with where I am going wrong?<br />
<br />
 <pre style="margin:20px; line-height:13px">unsafe<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bitmap b1 = (Bitmap)pictureBox1.Image.Clone();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bitmap b2 = new Bitmap(b1.Width, b1.Height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitmapData bd1 = b1.LockBits(new Rectangle(0, 0, b1.Width, b1.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitmapData bd2 = b2.LockBits(new Rectangle(0, 0, b2.Width, b2.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* p1 = (byte*)(void*)bd1.Scan0.ToPointer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* p2 = (byte*)(void*)bd2.Scan0.ToPointer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Graphics g = Graphics.FromImage(b2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //g.DrawImage(b1, new Rectangle(0, 0, b1.Width, b1.Height), new Rectangle(0, 0, b1.Width, b1.Height), GraphicsUnit.Pixel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //g.Dispose();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] aminx = { -(b1.Width * b1.Height) / 2, 0, -(b1.Width * b1.Height) / 2, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] amaxx = { 0, (b1.Width * b1.Height) / 2, 0, (b1.Width * b1.Height) / 2 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] aminy = { -(b1.Width * b1.Height) / 2, -(b1.Width * b1.Height) / 2, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] amaxy = { 0, 0, (b1.Width * b1.Height) / 2, (b1.Width * b1.Height) / 2 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int x = 0; x &lt; b2.Width; x++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int y = 0; y &lt; b2.Height; y++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] RValues = { 0, 0, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] GValues = { 0, 0, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] BValues = { 0, 0, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] NumPixels = { 0, 0, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] MaxRValue = { 0, 0, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] MaxGValue = { 0, 0, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] MaxBValue = { 0, 0, 0, 0 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] MinRValue = { 255, 255, 255, 255 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] MinGValue = { 255, 255, 255, 255 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int[] MinBValue = { 255, 255, 255, 255 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; 4; ++i)<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 x2 = aminx[i]; x2 &lt; amaxx[i]; ++x2)<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; int TempX = x + x2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (TempX &gt;= 0 &amp;&amp; TempX &lt; b2.Width)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; for (int y2 = aminy[i]; y2 &lt; amaxy[i]; ++y2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; int TempY = y + y2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (TempY &gt;= 0 &amp;&amp; TempY &lt; b2.Height)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Color TempColor = b1.GetPixel(TempX, TempY);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RValues[i] += p1[2];// TempColor.R;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GValues[i] += p1[1];// TempColor.G;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BValues[i] += p1[0];// TempColor.B;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (p1[2] &gt; MaxRValue[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MaxRValue[i] = p1[2];// TempColor.R;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (p1[2] &lt; MinRValue[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MinRValue[i] = p1[2];// TempColor.R;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (p1[1] &gt; MaxGValue[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MaxGValue[i] = p1[1];// TempColor.G;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (p1[1] &lt; MinGValue[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MinGValue[i] = p1[1];// TempColor.G;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (p1[0] &gt; MaxBValue[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MaxBValue[i] = p1[0];// TempColor.B;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (p1[0] &lt; MinBValue[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MinBValue[i] = p1[0];// TempColor.B;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++NumPixels[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p1 += 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int j = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int mind = 10000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; 4; i++)<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 cd = MaxRValue[i] - MinRValue[i] + MaxGValue[i] - MinGValue[i] + MaxBValue[i] - MinBValue[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (cd &lt; mind &amp;&amp; NumPixels[i] &gt; 0)<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; j = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mind = cd;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p2[0] = (byte)(BValues[j] / NumPixels[j]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p2[1] = (byte)(GValues[j] / NumPixels[j]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p2[2] = (byte)(RValues[j] / NumPixels[j]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Color meanpixel = Color.FromArgb(RValues[j] / NumPixels[j], GValues[j] / NumPixels[j], BValues[j] / NumPixels[j]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //b2.SetPixel(x, y, meanpixel);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2.Save(@&quot;C:\users\pashok\tt.jpg&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int boo = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2.Save(@&quot;C:\users\pashok\kuw.jpg&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b1.UnlockBits(bd1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2.UnlockBits(bd2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textBox1.Text = &quot;at the end&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //pictureBox2.Image = (Image)b2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; catch(Exception ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>sathya8819</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240006.html</guid>
		</item>
		<item>
			<title>vertical line</title>
			<link>http://www.daniweb.com/forums/thread240003.html</link>
			<pubDate>Fri, 20 Nov 2009 12:21:02 GMT</pubDate>
			<description><![CDATA[hello, 
 
I'm happy to participate in this forum and this is my first post. 
our instructor gave us an assignment to design an id using C# windows application and i don' know how to put vertical line using label or any thing 
 
thanks in advance]]></description>
			<content:encoded><![CDATA[<div>hello,<br />
<br />
I'm happy to participate in this forum and this is my first post.<br />
our instructor gave us an assignment to design an id using C# windows application and i don' know how to put vertical line using label or any thing<br />
<br />
thanks in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>annaqah</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240003.html</guid>
		</item>
		<item>
			<title>Cosequence of avoiding loops?</title>
			<link>http://www.daniweb.com/forums/thread239961.html</link>
			<pubDate>Fri, 20 Nov 2009 08:39:30 GMT</pubDate>
			<description><![CDATA[Suppose in my one particular piece of code, I am avoiding loops. 
ie instead of providing 'for' loop to do the task , I am copying and pasting a part three or four times to make it simple (?)to code. 
 
In this case what are the consequences of my action?  
 
I feel that only problem is a increased...]]></description>
			<content:encoded><![CDATA[<div>Suppose in my one particular piece of code, I am avoiding loops.<br />
ie instead of providing 'for' loop to do the task , I am copying and pasting a part three or four times to make it simple (?)to code.<br />
<br />
In this case what are the consequences of my action? <br />
<br />
I feel that only problem is a increased code size - which is not an issue when GBs of Hard disk space is available. Is my understanding correct? Any other issues like more RAM consumption or increased execution time? or anything else?<br />
<br />
Thanks<br />
Roy Thomas</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>RoyMicro</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239961.html</guid>
		</item>
		<item>
			<title>Problem with DrawString under Windows 7</title>
			<link>http://www.daniweb.com/forums/thread239959.html</link>
			<pubDate>Fri, 20 Nov 2009 08:31:38 GMT</pubDate>
			<description><![CDATA[I need to convert text to image, using specified fonts, size, etc. 
Looks like everything is ok when using standard DrawString method 
but, when I'm trying to do it under Windows 7 I have my picture blurred 
this is a screenshot from Windows XP / Windows 2008 server...]]></description>
			<content:encoded><![CDATA[<div>I need to convert text to image, using specified fonts, size, etc.<br />
Looks like everything is ok when using standard DrawString method<br />
but, when I'm trying to do it under Windows 7 I have my picture blurred<br />
this is a screenshot from Windows XP / Windows 2008 server<br />
<a rel="nofollow" class="t" href="http://testmyblog.ho.ua/pictures/xp.png" target="_blank">http://testmyblog.ho.ua/pictures/xp.png</a><br />
and this is from Windows 7<br />
<a rel="nofollow" class="t" href="http://testmyblog.ho.ua/pictures/7.png" target="_blank">http://testmyblog.ho.ua/pictures/7.png</a><br />
also I tried to play with System.Drawing.Imaging.Encoder.Quality;<br />
but even with max value of EncoderParameter blur effect doesn't disappear <br />
I have no idea where is the problem, hope that you will be able to help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Solmyr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239959.html</guid>
		</item>
		<item>
			<title>Help For System Message Handling</title>
			<link>http://www.daniweb.com/forums/thread239946.html</link>
			<pubDate>Fri, 20 Nov 2009 07:15:25 GMT</pubDate>
			<description>In event driven programming windows os is passing message to all application thread for firing events. 
 
What i want to do is?? 
I want to receive all messages in my application which is generated by system to any application or any any thread. 
 
I know little bit about mouse hooking and keyboard...</description>
			<content:encoded><![CDATA[<div>In event driven programming windows os is passing message to all application thread for firing events.<br />
<br />
What i want to do is??<br />
I want to receive all messages in my application which is generated by system to any application or any any thread.<br />
<br />
I know little bit about mouse hooking and keyboard hooking.<br />
but this will only receive messages like mouse move or any key is pressed,hot key pressed etc.<br />
<br />
but i want to receive every every message like any file creation , file deletion or file accessed etc.<br />
<br />
i just want to receive this messages , i dont want to interupt any of message. I want this messages to keep track of what user have done during a period of time.<br />
<br />
please any help regarding this ...<br />
any api for this??<br />
or i have to create global hook.<br />
but in creation of global there is problem like we have to create dll in C++ for call back function.<br />
but i want to do it fully through C# and main thing is that i m having not much time.<br />
<br />
at max from today onwards i will have 7-8 day to complete this.<br />
<br />
any help or any advice like in which direction i should proccedd.<br />
thnks for giving your time.............</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>crazyboy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239946.html</guid>
		</item>
		<item>
			<title>C# Lists - Beginner Help (XNA)</title>
			<link>http://www.daniweb.com/forums/thread239879.html</link>
			<pubDate>Fri, 20 Nov 2009 01:13:43 GMT</pubDate>
			<description><![CDATA[Hello everyone, pleased to be on the forum. 
 
I'm currently undertaking some game development in Visual Studio, in my spare time. I've been programming for a few months, in Java, and now am having a go at C#. I have however run into a little snag with lists. I'm trying to create a board game, in...]]></description>
			<content:encoded><![CDATA[<div>Hello everyone, pleased to be on the forum.<br />
<br />
I'm currently undertaking some game development in Visual Studio, in my spare time. I've been programming for a few months, in Java, and now am having a go at C#. I have however run into a little snag with lists. I'm trying to create a board game, in which the characters move one step at a time around the board.<br />
<br />
What I would like to know (as I've been searching for quite a while), is how to cycle through a List, and how to edit the contents of a list. In Java, I could use List.size() I believe, what is the C# equivalent?<br />
<br />
Here is a snippet of the code I am using:<br />
<br />
 <pre style="margin:20px; line-height:13px">//create a list of properties<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List &lt;Properties&gt;properties = new List&lt;Properties&gt;();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //initialize all the properties<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.Add(new Properties(<span style="font-weight:bold">(pos1)</span>, &quot;GO&quot;, false, false, 0, 0, 0, 0, false, false));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.Add(new Properties(<span style="font-weight:bold">(pos2)</span>, &quot;Derelict Building&quot;, false, false, 200, 6, 60, 200, false, false));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.Add(new Properties(<span style="font-weight:bold">(pos3)</span>, &quot;Shooting Range&quot;, false, false, 200, 8, 80, 200, false, false));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.Add(new Properties(<span style="font-weight:bold">(pos4)</span>, &quot;Youth Hostel&quot;, false, false, 0, 100, 250, 0, false, false));</pre><br />
I want to cycle through the list, and say that if a variable, player1pos, is equal to pos(i) (the emboldened items), then to decrement the value of a dice roll and move to the next item in the list.<br />
<br />
Here's a vague attempt at the code that obviously drew up syntactic errors...<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(player1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x = diceRoll.Roll(1,6);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (x != 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i; i &lt; properties.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (player1pos == properties.pos(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; player1pos = properties.pos(i + 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = x - 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
Each position (pos1, pos2, pos3, player1pos) is a co-ordinate of the type Vector2. <br />
<br />
So basically, I want to cycle through a list, and to isolate the position variables.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Gerard I MUFC</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239879.html</guid>
		</item>
		<item>
			<title>Weird error</title>
			<link>http://www.daniweb.com/forums/thread239863.html</link>
			<pubDate>Thu, 19 Nov 2009 23:29:47 GMT</pubDate>
			<description><![CDATA[Hi, 
 
In my code I'm getting a weird error. It's caused by this piece of code: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
In my code I'm getting a weird error. It's caused by this piece of code:<br />
<br />
 <pre style="margin:20px; line-height:13px">response = SQLCommand.ExecuteNonQuery();</pre><br />
The error: There is missing a ; at the end of the SQL-instruction.<br />
My eyes may be bad, but I clearly see a ; at the end of this piece of code.<br />
<br />
Any solutions??</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Calaesto</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239863.html</guid>
		</item>
		<item>
			<title>input string was not in a correct format</title>
			<link>http://www.daniweb.com/forums/thread239831.html</link>
			<pubDate>Thu, 19 Nov 2009 19:39:22 GMT</pubDate>
			<description><![CDATA[Hi All, 
I am getting the message "input string was not in a correct format" about the line " numline[i] = Convert.ToDouble(num);" 
The program is supposed to read a csv and convert the fifth line of the file to an double array.  The line to be read in looks like (and keeps going with 20 more...]]></description>
			<content:encoded><![CDATA[<div>Hi All,<br />
I am getting the message &quot;input string was not in a correct format&quot; about the line &quot; numline[i] = Convert.ToDouble(num);&quot;<br />
The program is supposed to read a csv and convert the fifth line of the file to an double array.  The line to be read in looks like (and keeps going with 20 more numbers in that form):<br />
&quot;22.925507, 0.0000000, 0.0000000, &quot;<br />
<br />
I'm new to C# and this seemingly simple task has taken surprisingly long!  Thanks in advance :)<br />
<br />
Liam<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ArrayList mtext = new ArrayList(); //declare array list for all data to be stored in as strings<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string textline; //each line of text, one at a time.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 0; //counter for which value in textline<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double[] numline = new double[25]; //double equivalent of textline<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string[] textlinesplit = new string[25]; //after textline is split into seperate numbers<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using (StreamReader m_reader = new StreamReader(@&quot;C:\Users\Andreas\Documents\out5.csv&quot;)) //initialize file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while ((textline = m_reader.ReadLine()) != null) //read until end of file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (textline.Length == 0) //if end of file, leave loop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (mtext.Count == 3) //if we're on the 5th line of numbers, convert line to double array<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textlinesplit = textline.Split(',');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (string num in textlinesplit)<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; if (num != null)<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; numline[i] = Convert.ToDouble(num);<br />
&nbsp; &nbsp; &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; 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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mtext.Add(textline); // insert line at end of list<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>LiamOB</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239831.html</guid>
		</item>
		<item>
			<title>C# Smpp Gateway / Server</title>
			<link>http://www.daniweb.com/forums/thread239801.html</link>
			<pubDate>Thu, 19 Nov 2009 17:01:49 GMT</pubDate>
			<description><![CDATA[Hey All, 
 
not sure if i'm correct here but i will try. 
 
I'm creating at the moment a SMPP Server / Gateway in c#. 
The server itself is working fine but i have one little thing to finish the work (as ever). 
 
When receiving a new message through submit_sm i have a small issue decoding the...]]></description>
			<content:encoded><![CDATA[<div>Hey All,<br />
<br />
not sure if i'm correct here but i will try.<br />
<br />
I'm creating at the moment a SMPP Server / Gateway in c#.<br />
The server itself is working fine but i have one little thing to finish the work (as ever).<br />
<br />
When receiving a new message through submit_sm i have a small issue decoding the message. I get everything except the message itself. So what i mean is: I'm getting the service_type the esm class and everything in the message till the sm_length. The problem now is when the smpp client is sending the message with a default encoding and the message contains (äöüß) (German characters) then i won't get these characters back. I know that other systems like Nowsms or Ozeki NG can do that.<br />
<br />
Perhaps somebody has decoded such kind of message before and can give me some hints. I tried with different encoding mechanism but nothing helps here.<br />
<br />
Regards</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>viper77</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239801.html</guid>
		</item>
		<item>
			<title>Creating form for application`s installation</title>
			<link>http://www.daniweb.com/forums/thread239799.html</link>
			<pubDate>Thu, 19 Nov 2009 16:55:13 GMT</pubDate>
			<description><![CDATA[I would like to do windows from with would guide the user through the installation of my already done win application. 
 
I already did the Setup Project (File > Add > New Project and select Other Project Types > Setup And Deployment > Setup Project. ) 
but I would like to do a window form (with...]]></description>
			<content:encoded><![CDATA[<div>I would like to do windows from with would guide the user through the installation of my already done win application.<br />
<br />
I already did the Setup Project (File &gt; Add &gt; New Project and select Other Project Types &gt; Setup And Deployment &gt; Setup Project. )<br />
but I would like to do a window form (with the whole installation procedure), where the user can choose the path where to install this app. and if he want the shortcuts on the desktop or in the user`s programs menu.<br />
<br />
Do I need to do a new Windows forms application, or can be build into the one I already did, or is this possible to get it somewhere - already made?<br />
<br />
That I can simply looks something like that:<br />
<a rel="nofollow" class="t" href="http://www.file.si/files/b783dnumjitk2c5mx0yc.jpg" target="_blank">PICTURE1</a><br />
or something more professional:<br />
<a rel="nofollow" class="t" href="http://www.file.si/files/ecpy0qz69wer29eie0yn.jpg" target="_blank">PICTURE 2</a><br />
<br />
These are just examples, of what I would like to do. Any Ideas?<br />
And the most important thing, if I do this win application, how do I then point to my setup.exe file, which is needed to extract?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239799.html</guid>
		</item>
		<item>
			<title>Connect C# to Mysql</title>
			<link>http://www.daniweb.com/forums/thread239784.html</link>
			<pubDate>Thu, 19 Nov 2009 15:31:52 GMT</pubDate>
			<description>I wanted to connect  mysql with C# But I was faced with the following error 
 
 
 
error text:connection unexpectedly terminated 
 
 
 
Please help me</description>
			<content:encoded><![CDATA[<div>I wanted to connect  mysql with C# But I was faced with the following error<br />
<br />
<br />
<br />
error text:connection unexpectedly terminated<br />
<br />
<br />
<br />
Please help me</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>jas2010</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239784.html</guid>
		</item>
		<item>
			<title>How to impersonate not local user?</title>
			<link>http://www.daniweb.com/forums/thread239760.html</link>
			<pubDate>Thu, 19 Nov 2009 13:59:49 GMT</pubDate>
			<description><![CDATA[Hi, I ask you for a problem I can't resolve. 
  
I'm developing a form application in C# and I need to access a web application (IIS) within the intranet and not to insert crediantials manually (I keep them in code). 
  
I tried using both Win32NativeMethods.LogonUser and advapi32.dll's Logon User...]]></description>
			<content:encoded><![CDATA[<div>Hi, I ask you for a problem I can't resolve.<br />
 <br />
I'm developing a form application in C# and I need to access a web application (IIS) within the intranet and not to insert crediantials manually (I keep them in code).<br />
 <br />
I tried using both Win32NativeMethods.LogonUser and advapi32.dll's Logon User methods, but they both return false. Why? Username, domain and password I use are profiled on the remote machine, not on my local machine. Might this be the problem? <br />
<br />
There are some solutions on the web but they don't work for me. <br />
<br />
Could you help me, please? <br />
<br />
Following is the code I tried to use (references: <a rel="nofollow" class="t" href="http://platinumdogs.wordpress.com/2008/10/30/net-c-impersonation-with-network-credentials/#comment-770" target="_blank">http://platinumdogs.wordpress.com/20...s/#comment-770</a>) <br />
<br />
 <pre style="margin:20px; line-height:13px">using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.IO;<br />
using System.Security.Principal;<br />
using System.Runtime.InteropServices;<br />
using System.ComponentModel;<br />
<br />
namespace OpenWebBrowser_authenticated_CS<br />
{<br />
&nbsp; &nbsp; class Program<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; [STAThread]<br />
&nbsp; &nbsp; &nbsp; &nbsp; static void Main(string[] args)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using (new Impersonator(&quot;username&quot;, &quot;domain&quot;, &quot;password&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string siteUrl = &quot;http://mywebapplication&quot;;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Diagnostics.Process.Start(siteUrl);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public enum LogonType<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_LOGON_INTERACTIVE = 2,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_LOGON_NETWORK = 3,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_LOGON_BATCH = 4,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_LOGON_SERVICE = 5,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_LOGON_UNLOCK = 7,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_LOGON_NETWORK_CLEARTEXT = 8, // Win2K or higher<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_LOGON_NEW_CREDENTIALS = 9 // Win2K or higher<br />
&nbsp; &nbsp; };<br />
<br />
&nbsp; &nbsp; public enum LogonProvider<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_PROVIDER_DEFAULT = 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_PROVIDER_WINNT35 = 1,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_PROVIDER_WINNT40 = 2,<br />
&nbsp; &nbsp; &nbsp; &nbsp; LOGON32_PROVIDER_WINNT50 = 3<br />
&nbsp; &nbsp; };<br />
<br />
&nbsp; &nbsp; public enum ImpersonationLevel<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; SecurityAnonymous = 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp; SecurityIdentification = 1,<br />
&nbsp; &nbsp; &nbsp; &nbsp; SecurityImpersonation = 2,<br />
&nbsp; &nbsp; &nbsp; &nbsp; SecurityDelegation = 3<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; class Win32NativeMethods<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; [DllImport(&quot;advapi32.dll&quot;, SetLastError = true)]<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static extern int LogonUser(string lpszUserName,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string lpszDomain,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string lpszPassword,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int dwLogonType,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int dwLogonProvider,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ref IntPtr phToken);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; [DllImport(&quot;advapi32.dll&quot;, CharSet = CharSet.Auto, SetLastError = true)]<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static extern int DuplicateToken(IntPtr hToken,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int impersonationLevel,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ref IntPtr hNewToken);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; [DllImport(&quot;advapi32.dll&quot;, CharSet = CharSet.Auto, SetLastError = true)]<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static extern bool RevertToSelf();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; [DllImport(&quot;kernel32.dll&quot;, CharSet = CharSet.Auto)]<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static extern bool CloseHandle(IntPtr handle);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; /// Allows code to be executed under the security context of a specified user account.<br />
&nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; /// &lt;remarks&gt; <br />
&nbsp; &nbsp; ///<br />
&nbsp; &nbsp; /// Implements IDispose, so can be used via a using-directive or method calls;<br />
&nbsp; &nbsp; ///&nbsp; ...<br />
&nbsp; &nbsp; ///<br />
&nbsp; &nbsp; ///&nbsp; var imp = new Impersonator( &quot;myUsername&quot;, &quot;myDomainname&quot;, &quot;myPassword&quot; );<br />
&nbsp; &nbsp; ///&nbsp; imp.UndoImpersonation();<br />
&nbsp; &nbsp; ///<br />
&nbsp; &nbsp; ///&nbsp; ...<br />
&nbsp; &nbsp; ///<br />
&nbsp; &nbsp; ///&nbsp;  var imp = new Impersonator();<br />
&nbsp; &nbsp; ///&nbsp; imp.Impersonate(&quot;myUsername&quot;, &quot;myDomainname&quot;, &quot;myPassword&quot;);<br />
&nbsp; &nbsp; ///&nbsp; imp.UndoImpersonation();<br />
&nbsp; &nbsp; ///<br />
&nbsp; &nbsp; ///&nbsp; ...<br />
&nbsp; &nbsp; ///<br />
&nbsp; &nbsp; ///&nbsp; using ( new Impersonator( &quot;myUsername&quot;, &quot;myDomainname&quot;, &quot;myPassword&quot; ) )<br />
&nbsp; &nbsp; ///&nbsp; {<br />
&nbsp; &nbsp; ///&nbsp;  ...<br />
&nbsp; &nbsp; ///&nbsp;  [code that executes under the new context]<br />
&nbsp; &nbsp; ///&nbsp;  ...<br />
&nbsp; &nbsp; ///&nbsp; }<br />
&nbsp; &nbsp; ///<br />
&nbsp; &nbsp; ///&nbsp; ...<br />
&nbsp; &nbsp; /// &lt;/remarks&gt;<br />
&nbsp; &nbsp; public class Impersonator : IDisposable<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; private WindowsImpersonationContext _wic;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Begins impersonation with the given credentials, Logon type and Logon provider.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;userName&quot;&gt;Name of the user.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;domainName&quot;&gt;Name of the domain.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;password&quot;&gt;The password. &lt;see cref=&quot;System.String&quot;/&gt;&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;logonType&quot;&gt;Type of the logon.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;logonProvider&quot;&gt;The logon provider. &lt;see cref=&quot;Mit.Sharepoint.WebParts.EventLogQuery.Network.LogonProvider&quot;/&gt;&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Impersonator(string userName, string domainName, string password, LogonType logonType, LogonProvider logonProvider)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Impersonate(userName, domainName, password, logonType, logonProvider);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Begins impersonation with the given credentials.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;userName&quot;&gt;Name of the user.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;domainName&quot;&gt;Name of the domain.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;password&quot;&gt;The password. &lt;see cref=&quot;System.String&quot;/&gt;&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Impersonator(string userName, string domainName, string password)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Impersonate(userName, domainName, password, LogonType.LOGON32_LOGON_INTERACTIVE, LogonProvider.LOGON32_PROVIDER_DEFAULT);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Initializes a new instance of the &lt;see cref=&quot;Impersonator&quot;/&gt; class.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Impersonator()<br />
&nbsp; &nbsp; &nbsp; &nbsp; { }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void Dispose()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UndoImpersonation();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Impersonates the specified user account.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;userName&quot;&gt;Name of the user.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;domainName&quot;&gt;Name of the domain.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;password&quot;&gt;The password. &lt;see cref=&quot;System.String&quot;/&gt;&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void Impersonate(string userName, string domainName, string password)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Impersonate(userName, domainName, password, LogonType.LOGON32_LOGON_INTERACTIVE, LogonProvider.LOGON32_PROVIDER_DEFAULT);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Impersonates the specified user account.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;userName&quot;&gt;Name of the user.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;domainName&quot;&gt;Name of the domain.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;password&quot;&gt;The password. &lt;see cref=&quot;System.String&quot;/&gt;&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;logonType&quot;&gt;Type of the logon.&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ///&lt;param name=&quot;logonProvider&quot;&gt;The logon provider. &lt;see cref=&quot;Mit.Sharepoint.WebParts.EventLogQuery.Network.LogonProvider&quot;/&gt;&lt;/param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void Impersonate(string userName, string domainName, string password, LogonType logonType, LogonProvider logonProvider)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UndoImpersonation();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr logonToken = IntPtr.Zero;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr logonTokenDuplicate = IntPtr.Zero;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // revert to the application pool identity, saving the identity of the current requestor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _wic = WindowsIdentity.Impersonate(IntPtr.Zero);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // do logon &amp; impersonate<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Win32NativeMethods.LogonUser(userName,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; domainName,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; password,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (int)logonType,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (int)logonProvider,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ref logonToken) != 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Win32NativeMethods.DuplicateToken(logonToken, (int)ImpersonationLevel.SecurityImpersonation, ref logonTokenDuplicate) != 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WindowsIdentity wi = new WindowsIdentity(logonTokenDuplicate);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wi.Impersonate(); // discard the returned identity context (which is the context of the application pool)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new Win32Exception(Marshal.GetLastWin32Error());<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; &nbsp; &nbsp; throw new Win32Exception(Marshal.GetLastWin32Error());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finally<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (logonToken != IntPtr.Zero)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Win32NativeMethods.CloseHandle(logonToken);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (logonTokenDuplicate != IntPtr.Zero)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Win32NativeMethods.CloseHandle(logonTokenDuplicate);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// Stops impersonation.<br />
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void UndoImpersonation()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // restore saved requestor identity<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (_wic != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _wic.Undo();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _wic = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>saggiatorius</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239760.html</guid>
		</item>
	</channel>
</rss>
