How to get total number of folder counts in a drive

Description :


This code shows how to get total number of folder counts in a drive

[CODE]
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
MsgBox(GetFileCount("c:\"))

End If
End Sub
Public Function GetFileCount(ByVal strPath As String) As Integer
Try
Return System.IO.Directory.GetFiles(strPath).Length()
Catch ex As Exception
Throw New Exception("Error From GetFileCount Function" & ex.Message, ex)
End Try
End Function
End Class
[/CODE]

How to create Web Browser in vb.net

Abstract


Create new windows application by selecting New project.Drag and drop the one text box and button control to form.Add the Browser control to form then double click on the button control to bring up button's click event then put the below code
[code]
WebBrowser1.Navigate(TextBox1.Text)
[/code]

Sample Source Code



[code]
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
End Class

[/code]

How to show openfile dialogue box while clicking textbox of fileupload control of asp.net

Just assign like this in your page load event
FileUpload1.Attributes.Add("onmousedown", "document.getElementById('" + FileUpload1.ClientID + "').click()");

How to open word file with in iframe?

Just drag and drop the iframe in your page or else just paste the below code


In page load event just
myPDF.Attributes.Add("src", filepath);

How to show empty Gridview using ASP.Net

How to show Empty gridview?

Just create the Datatable and bind it to Gridview control.

Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Dim dtrow As DataRow
Dim dtNewTable As New DataTable
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dtcol, dtcol1 As New DataColumn
dtcol.DataType = System.Type.GetType("System.String")
dtcol.ColumnName = "Emp ID"
dtNewTable.Columns.Add(dtcol)
dtcol1.DataType = System.Type.GetType("System.String")
dtcol1.ColumnName = "Emp Name"
dtNewTable.Columns.Add(dtcol1)
Dim i As Integer
For i = 0 To 4
dtrow = dtNewTable.NewRow()
dtrow("Emp ID") = ""
dtrow("Emp Name") = ""
dtNewTable.Rows.Add(dtrow)
Next i
GridView1.DataSource = dtNewTable
GridView1.DataBind()
End Sub
End Class