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 Community Free programming tutorial and source code for beginners and professional http://www.scriptslibrary.net/c-sharp Mon, 06 Sep 2010 19:58:26 +0000 Joomla! 1.5 - Open Source Content Management en-gb Auto-Fill ComboBox Using C# http://www.scriptslibrary.net/c-sharp/117-auto-fill-combobox-using-c http://www.scriptslibrary.net/c-sharp/117-auto-fill-combobox-using-c First, lets bind the combo with some data:
]]>
ferasc@hotmail.com (Feras) C# Snippets Tue, 30 Jun 2009 06:35:54 +0000
Get User Domain Name in C# http://www.scriptslibrary.net/c-sharp/115-get-user-domain-name-in-c http://www.scriptslibrary.net/c-sharp/115-get-user-domain-name-in-c

{CODE brush: cpp;}
        protected string GetUserDomainName()
        {
            return System.Environment.UserDomainName;

        }
{/CODE}]]>
ferasc@hotmail.com (Feras) C# Snippets Mon, 29 Jun 2009 17:37:41 +0000
Progressbar in C# http://www.scriptslibrary.net/c-sharp/111-progressbar-in-c http://www.scriptslibrary.net/c-sharp/111-progressbar-in-c In this tutorial, we are going to use three members of the Progressbar class:
Minimum, Maximum, and Value.
The value should range between the minimum and maximum.

Create a new C# Application. Add the following controls to the main form:
Progressbar control, name it as pb.
Timer, name it as tr

progress bar
]]>
ferasc@hotmail.com (Feras) C# Snippets Fri, 26 Jun 2009 22:46:16 +0000
Bind an ADO.NET DataTable to a Combobox in C# http://www.scriptslibrary.net/c-sharp/108-bind-an-adonet-datatable-to-a-combobox-in-c http://www.scriptslibrary.net/c-sharp/108-bind-an-adonet-datatable-to-a-combobox-in-c Create a MS Access Database, and name it as db.
Add a new table to it:

Table name: Positions
Fields:
ID (number, primary key)
Name (text)

Create a new C# windows project; add a new form to it.
Add a ComboBox to the form, name is as cbPositions.

bindcombobox c#

Switch to View Code mode, copy and paste the following sub:
]]>
ferasc@hotmail.com (Feras) C# Snippets Thu, 25 Jun 2009 06:04:54 +0000
Socket Connect and Data Send in C# http://www.scriptslibrary.net/c-sharp/106-socket-connect-and-data-send-in-c http://www.scriptslibrary.net/c-sharp/106-socket-connect-and-data-send-in-c Function to connect to host machine, and send data via TCP Socket.

Required Namespace:
{CODE brush: cpp;}
using System.Net;
using System.Net.Sockets;
{/CODE}
The function:

]]>
ferasc@hotmail.com (Feras) C# Snippets Thu, 25 Jun 2009 02:38:30 +0000
Create a File and Write to it Using FileStream in C# http://www.scriptslibrary.net/c-sharp/105-create-a-file-and-write-to-it-using-filestream-in-c http://www.scriptslibrary.net/c-sharp/105-create-a-file-and-write-to-it-using-filestream-in-c Using the FileStream Namespace to create a text file, then write a string to it.

Namespace required:
{CODE brush: cpp;}
using System.IO;
{/CODE}

]]>
ferasc@hotmail.com (Feras) C# Snippets Wed, 24 Jun 2009 23:17:44 +0000
Play Audio Files Using C# http://www.scriptslibrary.net/c-sharp/104-play-audio-files-using-c http://www.scriptslibrary.net/c-sharp/104-play-audio-files-using-c
Namespace Requried:
{CODE brush: cpp;}
using System.Media;
{/CODE}

And the Function:
{CODE brush: cpp;}
        void PlayAudioFile (string filePath)

        {
            SoundPlayer SoundPlayer = new SoundPlayer();
            SoundPlayer.SoundLocation = filePath;
            SoundPlayer.Play();
        }
{/CODE}
That's it!]]>
ferasc@hotmail.com (Feras) C# Snippets Wed, 24 Jun 2009 21:10:14 +0000
DNS Reverse Lookup in C# http://www.scriptslibrary.net/c-sharp/102-dns-reverse-lookup-in-c- http://www.scriptslibrary.net/c-sharp/102-dns-reverse-lookup-in-c-
First, add the following controls to your form:
TextBox. Name it as txtHostName
Button. Name it as btnDNSReverseLookup

dns reverse Lookup
]]>
ferasc@hotmail.com (Feras) C# Snippets Wed, 24 Jun 2009 00:32:29 +0000
Create Registry Key in C# http://www.scriptslibrary.net/c-sharp/100-create-registry-key-in-c http://www.scriptslibrary.net/c-sharp/100-create-registry-key-in-c A simple code to create a Registry Key in your local machine:

Required Namespace:
{CODE brush: cpp;}
using Microsoft.Win32;
{/CODE}
And the function:
{CODE brush: cpp;}
        static void CreateRegistry()
        {
            try
            {
                // Save new Registry to HKEY_LOCAL_MACHINE
                RegistryKey rk = Registry.LocalMachine  ;
                // create new Registry subkey
                rk = rk.CreateSubKey("Software\\YouRegistrykey");
                rk.SetValue("Version", "1.1.0");
                rk.SetValue("AppKey", "1234");
                MessageBox.Show("New Registry setting created");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message );
            }
            

        }
{/CODE}
Happy Coding!

 

]]>
ferasc@hotmail.com (Feras) C# Snippets Tue, 23 Jun 2009 03:03:58 +0000
Get Drive Free Space in C# http://www.scriptslibrary.net/c-sharp/99-get-drive-free-space-in-c http://www.scriptslibrary.net/c-sharp/99-get-drive-free-space-in-c
Namespace:
{CODE brush: cpp;}
using System.IO;
{/CODE}
And the function:
{CODE brush: cpp;}
        string GetDriveInfo(string strfile)
        {
            string strInfo;
            strInfo = "";//initialize string
            try
            {


                FileInfo file = new FileInfo(strfile);
                DriveInfo driveinfo = new DriveInfo(file.FullName);

                strInfo += "Drive: " + driveinfo.Name;

                if (driveinfo.IsReady)
                {
                    strInfo += "\nFree space: " + driveinfo.AvailableFreeSpace.ToString();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return strInfo;

        }
{/CODE}
Function usage:
{CODE brush: cpp;}
MessageBox.Show(GetDriveInfo("C:/"));
{/CODE}
That's it!

 

]]>
ferasc@hotmail.com (Feras) C# Snippets Tue, 23 Jun 2009 02:09:14 +0000