Monday 18 August 2014

To delete selected Row by Key Down in GridView



private sub Grid1_keyDown()
if e.keycode=keys.Delete then

For Each row as DataGridViewRow in Grid1.SelectedRows
Grid1.Rows.Remove(row)
Next

end if

Tuesday 12 August 2014

Open PDF file by Clicking Link Button using ASP.NET

protected sub LInk_click()
Dim pdfPath As String = Server.MapPath("~/AM54640303_2014-05-12_18-51-10.pdf")
        Dim client As New WebClient()
        Dim buffer As [Byte]() = client.DownloadData(pdfPath)
        Response.ContentType = "application/pdf"
        Response.AddHeader("content-length", buffer.Length.ToString())
        Response.BinaryWrite(buffer)

end sub


--"pdf file should be present in solution explorer."

Open Word file by clicking link button in ASP.NET

 Protected Sub ll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ll.Click
        Response.Clear()
        Response.ContentType = "application/doc"
        Response.AddHeader("content-disposition", "attachment;filename=1.doc")
        Response.TransmitFile("1.doc")
        Response.End()
    End Sub


''1.doc" should be present in solution explorer of VS

Followers