Saturday, December 29, 2007

Server.MapPath Method

If you need to go to a file from your page, you may need to know the exact file path in order to access to it. In this case, you can use Server.MapPath method.Server.MapPath method takes a path as a parameter and returns the physical path corresponding to the path.For example, there is an xml file (database.xml) which stored a list of connection string is located in the C:\inetpub\wwwroot\webapplication1\database directory, and you need to get the connection string to connect to an appropriate database. The C:\inetpub\wwwroot...

Friday, December 28, 2007

List of Parameters Supported by Windows Media Player 7 and Later Version

By adding some PARAM elements in your Windows Media Player object, you can decide the outlook and the functionality of your Windows Media Player. It enables you to specify certain player properties when the page is browsed. Below is a list of common parameters supported by Windows Media Player and later version.autoStartDefault: trueDescription: Specifies or retrieves a value indicating whether the current media item begins playing automatically.balanceDefault: 0Description: Specify the current stereo balance.baseURLDefault:...

Thursday, December 20, 2007

Template Column VS Bound Column

This post will explain how to get information from your data grid for Template Column and Bound Column. There is so many times that when I am trying to retrieve the value of certain column from a data grid, I can get the value of the first column (Bound Column). However, I cannot get the value of the second column (Template Column). And both of the columns are not empty though.The explanation below is what I had found out finally.Basically, the difference between BoundColumn and TemplateColumn is that you have more control over...

Tuesday, December 18, 2007

Hiding and Showing Columns in the Data Grid

Some programmers have face the problem controlling the visibility of certain column in the Data Grid control. In this post, I will show you how to hide and show certain column in the data grid.Data grid control has a property called AutoGenerateColumns. By default, its values is set to True, which will contain all of the column names of the data set as you bind it with the data set. If you set the AutoGenerateColumns to True, then you would not be able to control the visibility of the columns. You can either use asp:BoundColumn...

Friday, December 14, 2007

Server.Transfer VS Server.Execute

Server.TransferServer.Transfer takes the control execution of the page to the new page and thereafter it doees not return to the original page. This execution happens at the server side and the client is unaware of the change, and hence it maintains the original URL. Server.ExecuteIn Server.Execute method, a URL is passed as a parameter, and the control moves to this specified page. Execution of code happens on this specified page. Once the execution is over, the control will return to the original page. This method is very...

Wednesday, December 12, 2007

Server.Transfer VS Response.Redirect

Example: A webform1.aspx wants to send the user to webform2.aspx.Response.RedirectResponse.Redirect method simply causes the client browser to move to another specified URL, as code below:Response.Redirect(“webform2.aspx”)When it is called, it will send a 302 (Object Moved) redirect header to the client browser, telling it that webform1.aspx has moved to webform2.aspx and then the browser will send a request to the server for webform2.aspx. When the browser receives responses from the server, it uses the header information to...

Tuesday, December 11, 2007

Adding an embedded Windows Media Player on HTML document

This article describes how to embed Windows Media Player to play music or video in HTML document, it also includes required code in HTML and JavaScript.To embed Windows Media Player, you need to add an OBJECT element for the Windows Media Player ActiveX control. Here is the code to add the OBJECT element on your web page.<HTML><HEAD><TITLE>Embedded Windows Media Player Web Page</TITLE></HEAD><BODY><OBJECT ID="Player" width="320" height="240" CLASSID="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"></OBJECT></BODY></HTML>As...

Sunday, December 9, 2007

Column Chart in Microsoft Excel

Charts or graphs are an important part of your spreadsheets to summarize your data, and allow you to see clearly the data trends and patterns in your spreadsheets. Here I will provide a step by step tutorial on creating a Column Chart in Excel.First step of all, you need to enter the data into the spreadsheet. From the figure below, you can see an example of data.Using your mouse to drag and highlight the cells that...

Friday, December 7, 2007

Import data from CSV file into data set

In this post, I am going to use the OLE DB Provider for Jet to connect to and query CSV file and then load the data into a dataset.First of all, I will import the following namespaces:Imports System.DataImports System.Data.OleDbAnd then there is a function which will load data from a CSV file and return a dataset.Private Function LoadCsvData(ByVal filename As String) As DataSet 'Create a new connection Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\;" & _...

Thursday, December 6, 2007

Simple script to play music on a HTML document

You can use this EMBED script to play a music in HTML document.Take a look at the example below. Hope this will help you work it out.<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta name="description" content="play music"><meta name="GENERATOR" content="Microsoft FrontPage 3.0"><title>Play music<SCRIPT language=JavaScript type=text/javascript><!-- function StartPlay (){document.track.Play()}function StopPlay(){document.track.Stop()}// --></script></head><body...

Wednesday, December 5, 2007

Create Folder in MS Access

Let say you want to create a new folder if it does not exist when you run your application, here is the sample code:Dim strFolder As StringstrFolder = "C:\New Folder"Dim fsoSet fso = CreateObject("Scripting.FileSystemObject")‘Check whether the folder existsIf Not fso.FolderExists(strFolder) Then FileSystem.MkDir (strFolder)End...

Tuesday, December 4, 2007

How to install a Font in Windows

1. Choose Start -> Settings -> Control Panel. Note: In Windows XP, choose Start -> Control Panel.2. Double-clicks the Fonts icon.3. Choose File -> Install New Font.4. Use the Folders Directory box to go to the location where the font was saved. (Use the "Drives" drop-down to select the appropriate drive, if not "C:")5. The font(s) in the selected folder will display in the "List of Fonts" box. Use Ctrl+click...

Monday, December 3, 2007

Create a New Recordset in VBA

Here is the sample code on how to create a new recordset.Sub Create_recordset()Dim rst As New ADODB.Recordset‘Add columnsrst.Fields.Append “Field1”, adVarchar, 50rst.Fields.Append “Field2”, adVarchar, 50…‘Create recordsetrst.Open()‘Add rows into recordsetrst.AddNew Array("field1", "field2"), Array("string1", “val1”)rst.AddNew Array("field1", "field2"), Array("string2", “val2”)End SubHappy programmi...

Saturday, December 1, 2007

VBA Worksheet

Delete worksheets For Each ws In oWB.Worksheets ws.DeleteNextAdd a worksheetSub Add_Sheet()Dim wSht As WorksheetDim shtName As StringshtName = Format(Now, "mmmm_yyyy")For Each wSht In Worksheets If wSht.Name = shtName Then MsgBox "Sheet already exists! " Exit Sub Else Sheets.Add.Name = shtName Sheets(shtName).Move After:=Sheets(Sheets.Count) Sheets("Sheet1").Range("A1:A5").Copy _ Sheets(shtName).Range("A1") End IfNextEnd SubCopy a worksheetSub Copy_Sheet()Dim wSht As WorksheetDim...
 

Get paid for your opinions! Click on the banner above to join Planet Pulse. Its totally free to sign up, and you can earn UNLIMITED. Find out more by visiting PLANET PULSE.
Sign up for PayPal and start accepting credit card payments instantly. http://www.emailcashpro.com
July Code Blog Copyright © 2010 Blogger Template Designed by Bie Blogger Template