Posts

Showing posts from October, 2006

File Properties using C#

File Name of your file:When reviewing or opening a file, to get its name, the FileInfo class is equipped with the Name property. Here is an sample code:
FileInfo oFileInfo = new FileInfo(strFilename);
MessageBox.Show("My File's Name: \"" + oFileInfo.Name + "\"");

Date and Time a File Created

The Operating System takes care to keep track of the date and time of a file was created. To find out what those date and time values are, you can access the File System Information property using.

DateTime dtCreationTime = oFileInfo.CreationTime;
MessageBox.Show("Date and Time File Created: " + dtCreationTime.ToString());
Find your file extension:When you access a file or when the user opens one, to know the extension of the file, you can access the value of the FileSystemInfo.Extension property. MessageBox.Show("myFile Extension: " + oFileInfo.Extension);Find file size using C#:One of the routine operations the operating system performs consistly fo…

Community for .NET Technology

Here is one of the best interactive community for .NET Technology. All .NET technology lovers and programmers come lets add power to your .NET skill.

Click Here To Join The Community

Creating System Tray Applications in Windows Forms .NET 2.0

Image
This simple article explains how to implement the common features and functionalities required for a notification-based application in Windows Forms: starting up a Windows Forms application without showing a Form, using the NotifyIcon, bringing an existing Form to the front of the desktop, and closing the Form on minimize.

Create Icons At Runtime For The System Tray in .NET

This simple way of creating Icons for system tray at runtime using .NET. Here is the code sample for creating the Icon for sytem tray.

String TaskBarLetter;
// Create a graphics instance that draws to a bitmap
Bitmap bitmap = new Bitmap(16, 16);
SolidBrush brush = new SolidBrush(fontDialog1.Color);
Graphics graphics = Graphics.FromImage(bitmap);
// Draw then number to the bitmap using the user selected font
if (i != -1)
TaskBarLetter = i.ToString();
else
TaskBarLetter = "V";
graphics.DrawString(TaskBarLetter, fontDialog1.Font, brush, 0, 0);
// Convert the bitmap into an icon and use it for the system tray icon
IntPtr hI…

Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Beta

Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Beta (also known as “Visual Studio 2005 Tools for Office Second Edition Beta” or “VSTO 2005 SE Beta”) is an add-on to Microsoft Visual Studio 2005 that enables you to build application-level add-ins for the 2007 Microsoft Office system as well as the Microsoft Office 2003 Editions.

Download VSTO 2005 SE

This contains application level add-in project template for six applications in Office System 2007. One exception is the InfoPath 2007 form project template. If the InfoPath 2003 Toolkit is installed, VSTO 2005 SE Beta replaces it with the new InfoPath 2007 form project template.

VSTO 2005 is the technology that brings the power and productivity of Visual Studio .NET and the .NET Framework to business solutions built on Microsoft Word 2003, Microsoft Outlook 2003, Microsoft Excel 2003 or Microsoft InfoPath 2003.

Microsoft Visual Studio 2005 Tools for the Microsoft Office System (VSTO 2005) Redistributable Package (x86…

Creating Files using ASP.NET code behind VB.NET -- Save a file to a specific directory

In ASP.NET we can create a file and save it in a particular directory, to do the operation we have two different ways. One is using Response.Write("STRING") and another one is filestream.

First let me give you the sample code using Response.Write("STRING").

Code Sample using Response.Write("STRING"):

Imports System
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SqlClient

Public Class WebForm1
Inherits System.Web.UI.Page

Dim cn As SqlConnection
Dim cmd As SqlCommand
Dim filename As String
Dim dr As SqlDataReader
Dim i As Integer
Dim sb As System.Text.StringBuilder

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click
cn = New SqlConnection("server=localhost;uid=sa;pwd=;database=northwind")
filename = "products.csv"
cmd = New SqlCommand("select * from products ", cn)
cmd.Connection.Open()
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
sb =…