Here is the code for read the registry value using C#.
First I’m creating registry key value and string value in local machine as follows,
myKey –> key value
myValue –> string name
myReturnValue –> string value
Code for Registry value Reading using C#…
using Microsoft.Win32;
try
{
RegistryKey registry = Registry.LocalMachine.CreateSubKey(”SOFTWARE\\myKey”);
if (registry != null)
{
MessageBox.Show(registry.GetValue(”myValue”));
registry.Close();
}
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString());
}
Code for Values writing in Registry using [...]
Filed under: C# Code, Programming Logic by Rishav
No Comments »
The Code Written below Makes a Page that allows user to upload file to the Server.
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<script runat=”server”>
protected void UploadButton_Click(object sender, EventArgs e)
{// Specify the path on the server to save the uploaded file to.
String savePath = Server.MapPath(”~/UploadedFiles”);
// Before attempting to perform operations [...]
Filed under: ASP.NET, C# Code, Programming Logic by Rishav
No Comments »
The CSV files are files containing the values seperated by comma. These files are generally used to store contact Details becuase they are very much acceptable across different mail client and websites. Here i am writing code to craete a CSV file from the Data containe in the Datagrid View.
DatagridView Name = dataGridView1
File Created at [...]
Filed under: C# Code, Programming Logic by Rishav
No Comments »
Key board shortcut keys always help to increase your speed. It also saves your Time and at the same time impresses your Employer. It is always a Good habit to use keyboar shortcuts. So i am giving below some of the Keyboard Shortcuts which will be very useful in Visual Studio.
Ctrl + N :- Opens [...]
Filed under: General, Programming Logic by Rishav
No Comments »
Many of you have had develope applications that use the database for a proper functioning, the main problem comes when you consider to eploy you application at any other machine. The Database is not available at the machine, so your application gives error. To remove this error, there are two ways you create the database [...]
Filed under: C# Code, Programming Logic, SQL Server Help by Rishav
3 Comments »
Bored by using the same Rectangular Button Control from your toolbox. Us the method mentioned below to create a new control named CircularButton in your toolbox and use it in your Form. Just follow the steps below carefully.
Step 1 – Open your Windows Application or a new Window Application in Visual Studio 2005.
Step 2 – [...]
Filed under: C# Code, Programming Logic by Rishav
No Comments »
The code written below shows how to read element from an XML file.
using (XmlReader reader = XmlReader.Create(“book3.xml”))
{
// Parse the XML document. ReadString is used to read the text content of the elements.
reader.Read();
reader.ReadStartElement(“book”);
reader.ReadStartElement(“title”);
Console.Write(“The content of the title element: “);
Console.WriteLine(reader.ReadString());
reader.ReadEndElement();
reader.ReadStartElement(“price”);
Console.Write(“The content of the price element: “);
Console.WriteLine(reader.ReadString());
reader.ReadEndElement();
reader.ReadEndElement();
}
A [...]
Filed under: C# Code, Programming Logic by Rishav
No Comments »
To show the message box on the client side we need to use the client side scripting language like javascript.
To show a simple message box use the script written below
alert(”message to be dispalyed”);
To show a message with options of yes/no
<script language = “javascript” type = “text/javascript”>function choice
{
choice = confirm(
“are you sure”
)
if(choice)
{
//code when user clicks yes
}
}
</script>
Call [...]
Filed under: ASP.NET, Programming Logic by Rishav
No Comments »
The code written below allows usrs to send mail from their application by using their GMail Account. The sent mail is also saved in sent mail folder of your GMail account. The mail is 100% legitimate. Try the code by changing just few things.
Write the code below in an event of a button which is [...]
Filed under: C# Code, Programming Logic by Rishav
1 Comment »
There may be situtaions where you would want to hide your Title Bar. You can do it by using some of the properties of the Form. You can change it before run time or during run time using the code.
To change it before run time. Click on the form and see its properties windows and [...]
Filed under: C# Code, Programming Logic by Rishav
No Comments »