Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423
Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 426 C# - The Scripts Library CommunityFree programming tutorial and source code for beginners and professionalhttp://www.scriptslibrary.net/c-sharp2010-09-06T19:59:37ZJoomla! 1.5 - Open Source Content ManagementAuto-Fill ComboBox Using C#2009-06-30T06:35:54Z2009-06-30T06:35:54Zhttp://www.scriptslibrary.net/c-sharp/117-auto-fill-combobox-using-cFerasferasc@hotmail.comThis is simple code of how you fill a combobox automatically in C#.<br /> First, lets bind the combo with some data:<br />This is simple code of how you fill a combobox automatically in C#.<br /> First, lets bind the combo with some data:<br />Get User Domain Name in C#2009-06-29T17:37:41Z2009-06-29T17:37:41Zhttp://www.scriptslibrary.net/c-sharp/115-get-user-domain-name-in-cFerasferasc@hotmail.comGet user domain name in C#<br /><br /><br />{CODE brush: cpp;}<br /> protected string GetUserDomainName()<br /> {<br /> return System.Environment.UserDomainName;<br /><br /> }<br />{/CODE}Get user domain name in C#<br /><br /><br />{CODE brush: cpp;}<br /> protected string GetUserDomainName()<br /> {<br /> return System.Environment.UserDomainName;<br /><br /> }<br />{/CODE}Progressbar in C#2009-06-26T22:46:16Z2009-06-26T22:46:16Zhttp://www.scriptslibrary.net/c-sharp/111-progressbar-in-cFerasferasc@hotmail.comThe Progressbar Class is a part of the .NET framework, which provides progress bar control that can enhance your functionality of your application.<br /> In this tutorial, we are going to use three members of the Progressbar class:<br /> Minimum, Maximum, and Value.<br /> The value should range between the minimum and maximum.<br /><br /> Create a new C# Application. Add the following controls to the main form:<br /> Progressbar control, name it as pb.<br /> Timer, name it as tr<br /> <br /><img src="images/stories/progressbar.gif" border="0" alt="progress bar" title="progress bar" width="413" height="139" align="middle" /><br />The Progressbar Class is a part of the .NET framework, which provides progress bar control that can enhance your functionality of your application.<br /> In this tutorial, we are going to use three members of the Progressbar class:<br /> Minimum, Maximum, and Value.<br /> The value should range between the minimum and maximum.<br /><br /> Create a new C# Application. Add the following controls to the main form:<br /> Progressbar control, name it as pb.<br /> Timer, name it as tr<br /> <br /><img src="images/stories/progressbar.gif" border="0" alt="progress bar" title="progress bar" width="413" height="139" align="middle" /><br />Bind an ADO.NET DataTable to a Combobox in C#2009-06-25T06:04:54Z2009-06-25T06:04:54Zhttp://www.scriptslibrary.net/c-sharp/108-bind-an-adonet-datatable-to-a-combobox-in-cFerasferasc@hotmail.comHere is a simple code to Bind an ADO.NET DataTable to a ComboBox using C# and Microsoft Access.<br /> Create a MS Access Database, and name it as db.<br /> Add a new table to it:<br /> <br /> <strong>Table name: Positions</strong><br /> <u>Fields:</u><br /> ID (number, primary key)<br /> Name (text)<br /> <br /> Create a new C# windows project; add a new form to it.<br /> Add a ComboBox to the form, name is as cbPositions.<br /><br /><img src="images/stories/bindcomboboxvbnet.gif" border="0" alt="bindcombobox c#" title="bindcombobox c#" width="347" height="201" align="middle" /><br /><br /> Switch to View Code mode, copy and paste the following sub:<br />Here is a simple code to Bind an ADO.NET DataTable to a ComboBox using C# and Microsoft Access.<br /> Create a MS Access Database, and name it as db.<br /> Add a new table to it:<br /> <br /> <strong>Table name: Positions</strong><br /> <u>Fields:</u><br /> ID (number, primary key)<br /> Name (text)<br /> <br /> Create a new C# windows project; add a new form to it.<br /> Add a ComboBox to the form, name is as cbPositions.<br /><br /><img src="images/stories/bindcomboboxvbnet.gif" border="0" alt="bindcombobox c#" title="bindcombobox c#" width="347" height="201" align="middle" /><br /><br /> Switch to View Code mode, copy and paste the following sub:<br />Socket Connect and Data Send in C#2009-06-25T02:38:30Z2009-06-25T02:38:30Zhttp://www.scriptslibrary.net/c-sharp/106-socket-connect-and-data-send-in-cFerasferasc@hotmail.com<p>Function to connect to host machine, and send data via TCP Socket.<br /><br />Required Namespace:<br />{CODE brush: cpp;}<br />using System.Net;<br />using System.Net.Sockets;<br />{/CODE}<br />The function:</p><p>Function to connect to host machine, and send data via TCP Socket.<br /><br />Required Namespace:<br />{CODE brush: cpp;}<br />using System.Net;<br />using System.Net.Sockets;<br />{/CODE}<br />The function:</p>Create a File and Write to it Using FileStream in C#2009-06-24T23:17:44Z2009-06-24T23:17:44Zhttp://www.scriptslibrary.net/c-sharp/105-create-a-file-and-write-to-it-using-filestream-in-cFerasferasc@hotmail.com<p>Using the FileStream Namespace to create a text file, then write a string to it.<br /><br />Namespace required:<br />{CODE brush: cpp;}<br />using System.IO;<br />{/CODE}</p><p>Using the FileStream Namespace to create a text file, then write a string to it.<br /><br />Namespace required:<br />{CODE brush: cpp;}<br />using System.IO;<br />{/CODE}</p>Play Audio Files Using C#2009-06-24T21:10:14Z2009-06-24T21:10:14Zhttp://www.scriptslibrary.net/c-sharp/104-play-audio-files-using-cFerasferasc@hotmail.comFunction to play an audio file in C#. It uses the System.Media Namespace.<br /><br /> Namespace Requried:<br /> {CODE brush: cpp;}<br />using System.Media;<br />{/CODE}<br /><br />And the Function:<br />{CODE brush: cpp;}<br /> void PlayAudioFile (string filePath)<br /><br /> {<br /> SoundPlayer SoundPlayer = new SoundPlayer();<br /> SoundPlayer.SoundLocation = filePath;<br /> SoundPlayer.Play();<br /> }<br />{/CODE}<br />That's it!Function to play an audio file in C#. It uses the System.Media Namespace.<br /><br /> Namespace Requried:<br /> {CODE brush: cpp;}<br />using System.Media;<br />{/CODE}<br /><br />And the Function:<br />{CODE brush: cpp;}<br /> void PlayAudioFile (string filePath)<br /><br /> {<br /> SoundPlayer SoundPlayer = new SoundPlayer();<br /> SoundPlayer.SoundLocation = filePath;<br /> SoundPlayer.Play();<br /> }<br />{/CODE}<br />That's it!DNS Reverse Lookup in C#2009-06-24T00:32:29Z2009-06-24T00:32:29Zhttp://www.scriptslibrary.net/c-sharp/102-dns-reverse-lookup-in-c-Ferasferasc@hotmail.comThe following sample will show you how to get DNS Reverse Lookup for a particular IP. It uses the System.Net namespace.<br /> <br /> First, add the following controls to your form:<br /> TextBox. Name it as txtHostName<br /> Button. Name it as btnDNSReverseLookup<br /><br /> <img src="images/stories/dnsreserveLookup.gif" border="0" alt="dns reverse Lookup" title="dns reverse Lookup" width="297" height="140" align="middle" /><br />The following sample will show you how to get DNS Reverse Lookup for a particular IP. It uses the System.Net namespace.<br /> <br /> First, add the following controls to your form:<br /> TextBox. Name it as txtHostName<br /> Button. Name it as btnDNSReverseLookup<br /><br /> <img src="images/stories/dnsreserveLookup.gif" border="0" alt="dns reverse Lookup" title="dns reverse Lookup" width="297" height="140" align="middle" /><br />Create Registry Key in C#2009-06-23T03:03:58Z2009-06-23T03:03:58Zhttp://www.scriptslibrary.net/c-sharp/100-create-registry-key-in-cFerasferasc@hotmail.com<p>A simple code to create a Registry Key in your local machine:<br /><br />Required Namespace:<br />{CODE brush: cpp;}<br />using Microsoft.Win32;<br />{/CODE}<br />And the function:<br />{CODE brush: cpp;}<br /> static void CreateRegistry()<br /> {<br /> try<br /> {<br /> // Save new Registry to HKEY_LOCAL_MACHINE<br /> RegistryKey rk = Registry.LocalMachine ;<br /> // create new Registry subkey<br /> rk = rk.CreateSubKey("Software\\YouRegistrykey");<br /> rk.SetValue("Version", "1.1.0");<br /> rk.SetValue("AppKey", "1234");<br /> MessageBox.Show("New Registry setting created");<br /> }<br /> catch (Exception ex)<br /> {<br /> MessageBox.Show(ex.Message );<br /> }<br /> <br /><br /> }<br />{/CODE}<br />Happy Coding!</p><p> </p><p>A simple code to create a Registry Key in your local machine:<br /><br />Required Namespace:<br />{CODE brush: cpp;}<br />using Microsoft.Win32;<br />{/CODE}<br />And the function:<br />{CODE brush: cpp;}<br /> static void CreateRegistry()<br /> {<br /> try<br /> {<br /> // Save new Registry to HKEY_LOCAL_MACHINE<br /> RegistryKey rk = Registry.LocalMachine ;<br /> // create new Registry subkey<br /> rk = rk.CreateSubKey("Software\\YouRegistrykey");<br /> rk.SetValue("Version", "1.1.0");<br /> rk.SetValue("AppKey", "1234");<br /> MessageBox.Show("New Registry setting created");<br /> }<br /> catch (Exception ex)<br /> {<br /> MessageBox.Show(ex.Message );<br /> }<br /> <br /><br /> }<br />{/CODE}<br />Happy Coding!</p><p> </p>Get Drive Free Space in C#2009-06-23T02:09:14Z2009-06-23T02:09:14Zhttp://www.scriptslibrary.net/c-sharp/99-get-drive-free-space-in-cFerasferasc@hotmail.comFunction to get Drive free Space using C#:<br /> <br />Namespace:<br />{CODE brush: cpp;}<br />using System.IO;<br />{/CODE}<br /> And the function:<br />{CODE brush: cpp;}<br /> string GetDriveInfo(string strfile)<br /> {<br /> string strInfo;<br /> strInfo = "";//initialize string <br /> try<br /> {<br /><br /><br /> FileInfo file = new FileInfo(strfile);<br /> DriveInfo driveinfo = new DriveInfo(file.FullName);<br /><br /> strInfo += "Drive: " + driveinfo.Name;<br /><br /> if (driveinfo.IsReady)<br /> {<br /> strInfo += "\nFree space: " + driveinfo.AvailableFreeSpace.ToString();<br /> }<br /><br /> }<br /> catch (Exception ex)<br /> {<br /> MessageBox.Show(ex.Message);<br /> }<br /> return strInfo;<br /><br /> }<br />{/CODE}<br /> Function usage:<br />{CODE brush: cpp;}<br />MessageBox.Show(GetDriveInfo("C:/"));<br />{/CODE}<br /> That's it!<p> </p>Function to get Drive free Space using C#:<br /> <br />Namespace:<br />{CODE brush: cpp;}<br />using System.IO;<br />{/CODE}<br /> And the function:<br />{CODE brush: cpp;}<br /> string GetDriveInfo(string strfile)<br /> {<br /> string strInfo;<br /> strInfo = "";//initialize string <br /> try<br /> {<br /><br /><br /> FileInfo file = new FileInfo(strfile);<br /> DriveInfo driveinfo = new DriveInfo(file.FullName);<br /><br /> strInfo += "Drive: " + driveinfo.Name;<br /><br /> if (driveinfo.IsReady)<br /> {<br /> strInfo += "\nFree space: " + driveinfo.AvailableFreeSpace.ToString();<br /> }<br /><br /> }<br /> catch (Exception ex)<br /> {<br /> MessageBox.Show(ex.Message);<br /> }<br /> return strInfo;<br /><br /> }<br />{/CODE}<br /> Function usage:<br />{CODE brush: cpp;}<br />MessageBox.Show(GetDriveInfo("C:/"));<br />{/CODE}<br /> That's it!<p> </p>