Wednesday, July 30, 2014

Scan Document using vb.net code

Private Sub btnScanPage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScanPage.Click
        btnScanPage.Text = "Scanning Page, Please wait..."
        Me.Cursor = Cursors.WaitCursor
        If scan() = True Then
            btnScanPage.Text = "Scan Page"
            UgcDetails.lstattach.Items.Add(fileName)
            Me.Cursor = Cursors.Default
            Me.Close()
            Me.Dispose()
        End If
    End Sub
-------------------------------------------------------------------
--------------------------------Function scan-------------------
Private Function scan() As Boolean
        Try
            Dim commonDialogClass As New CommonDialogClass()
            Dim scannerDevice As Device = commonDialogClass.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, False, False)
            If scannerDevice IsNot Nothing Then
                Dim scannnerItem As Item = scannerDevice.Items(1)
                AdjustScannerSettings(scannnerItem, 100, 0, 0, 850, 1150, 0, 0)
                Dim scanResult As Object = commonDialogClass.ShowTransfer(scannnerItem, WIA.FormatID.wiaFormatPNG, False)
                If scanResult IsNot Nothing Then
                    Dim image As ImageFile = DirectCast(scanResult, ImageFile)
                    Dim path1 As String = "D:\scan\" & Me.Tag & "\"
                    My.Computer.FileSystem.CreateDirectory(path1)
                    fileName = path1 & Now.ToString.Replace("/", "").Replace("-", "").Replace(":", "") & ".jpg"
                    If SaveImageToFile(image, fileName) = True Then
                        PictureBox1.ImageLocation = fileName
                        Return True
                    End If
                End If
            End If
        Catch ex As Exception
            Return False
        End Try
    End Function

Tuesday, July 29, 2014

Add multiply Files at List box

 OpenFileDialog1.Multiselect = True
            OpenFileDialog1.Title = "Attach File"
            OpenFileDialog1.Filter = "All Files|*.*"
            If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                For Each fname As String In OpenFileDialog1.FileNames
                    lstattach.Items.Add(fname)
                Next
            End If

Thursday, July 17, 2014

For SMS

If Len(smscelno) = 10 Then
                    Dim convid As String = txtstate.Tag & "-" & Me.Tag
                  Dim smstxt As String = "Your complaint has been successfully registered.Your complaint No is " & convid " &
                    WebBrowsersms.Navigate("http://?uname= & pass= & send= & dest=91" & smscelno & "&msg=" & smstxt)
                    Do Until WebBrowsersms.ReadyState = WebBrowserReadyState.Complete
                        Application.DoEvents()
                    Loop
                End If

Friday, July 4, 2014

How, can i get forms name from vb.net ?

private sub proshowformnames()
  For Each FRM As Form In Application.OpenForms
     MsgBox(FRM.Name)
  Next
end sub