Function Name
|
2000
|
2005
|
2008
|
2008 R2
|
2012
|
Y
|
Y
|
Y
|
Y
|
Y
|
|
Y
|
Y
|
Y
|
Y
|
Y
|
|
N
|
N
|
N
|
N
|
Y
|
|
N
|
N
|
N
|
N
|
Y
|
|
N
|
N
|
N
|
N
|
Y
|
|
N
|
N
|
N
|
N
|
Y
|
Friday, December 26, 2014
SQL Server Functions that helps to convert date and time values to and from string literals and other date and time formats.
Wednesday, August 13, 2014
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
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
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
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
For Each FRM As Form In Application.OpenForms
MsgBox(FRM.Name)
Next
end sub
Friday, April 4, 2014
Read & Write Txt File in vb.net
Add class form in vb.net project
Imports System
Imports System.IO
Imports System.Text
Imports System.Collections.Generic
Imports Scripting
Public Class Testwrite
Public Sub DeleteFile(ByVal mydocpath As String, ByVal filename As String)
Dim fso As FileSystemObject = New FileSystemObject
If fso.FileExists(mydocpath + "\" & filename & ".set") = True Then
fso.DeleteFile(mydocpath + "\" & filename & ".set", True)
End If
End Sub
Public Sub WriteToFile(ByVal mydocpath As String, ByVal filename As String, ByVal datastring As String)
Dim sb As New StringBuilder()
sb.AppendLine(datastring)
Using outfile As StreamWriter = New StreamWriter(mydocpath + "\" & filename & ".Txt", True)
outfile.Write(sb.ToString())
End Using
End Sub
Public Function ReadFromSetFile(ByVal mydocpath As String, ByVal filename As String, ByVal key As String) As String
Dim txtbox As String = Nothing
Try
Using sr As StreamReader = New StreamReader(mydocpath + "\" & filename & ".set")
While Not sr.EndOfStream
Dim line = sr.ReadLine()
Dim seppos As Integer = InStr(line, "|")
If seppos > 0 Then
If line Like key & "*" Then
txtbox = Trim(Mid(line, seppos + 1))
Exit While
End If
End If
End While
End Using
Catch ex As Exception
txtbox = ""
End Try
Return txtbox
End Function
Public Function ReadFromFile(ByVal mydocpath As String, ByVal title As Boolean) As String
Dim line As String = Nothing
Try
Using sr As StreamReader = New StreamReader(mydocpath)
If title = True Then
line = sr.ReadLine
line = Nothing
End If
While Not sr.EndOfStream
line = sr.ReadLine()
End While
End Using
Catch
line = ""
End Try
Return line
End Function
End Class
Imports System
Imports System.IO
Imports System.Text
Imports System.Collections.Generic
Imports Scripting
Public Class Testwrite
Public Sub DeleteFile(ByVal mydocpath As String, ByVal filename As String)
Dim fso As FileSystemObject = New FileSystemObject
If fso.FileExists(mydocpath + "\" & filename & ".set") = True Then
fso.DeleteFile(mydocpath + "\" & filename & ".set", True)
End If
End Sub
Public Sub WriteToFile(ByVal mydocpath As String, ByVal filename As String, ByVal datastring As String)
Dim sb As New StringBuilder()
sb.AppendLine(datastring)
Using outfile As StreamWriter = New StreamWriter(mydocpath + "\" & filename & ".Txt", True)
outfile.Write(sb.ToString())
End Using
End Sub
Public Function ReadFromSetFile(ByVal mydocpath As String, ByVal filename As String, ByVal key As String) As String
Dim txtbox As String = Nothing
Try
Using sr As StreamReader = New StreamReader(mydocpath + "\" & filename & ".set")
While Not sr.EndOfStream
Dim line = sr.ReadLine()
Dim seppos As Integer = InStr(line, "|")
If seppos > 0 Then
If line Like key & "*" Then
txtbox = Trim(Mid(line, seppos + 1))
Exit While
End If
End If
End While
End Using
Catch ex As Exception
txtbox = ""
End Try
Return txtbox
End Function
Public Function ReadFromFile(ByVal mydocpath As String, ByVal title As Boolean) As String
Dim line As String = Nothing
Try
Using sr As StreamReader = New StreamReader(mydocpath)
If title = True Then
line = sr.ReadLine
line = Nothing
End If
While Not sr.EndOfStream
line = sr.ReadLine()
End While
End Using
Catch
line = ""
End Try
Return line
End Function
End Class
Wednesday, April 2, 2014
Remove Last Character From String
Dim str As String
str = TextBox1.Text
str = str.Remove(str.Length - 1)
MsgBox(str)
str = TextBox1.Text
str = str.Remove(str.Length - 1)
MsgBox(str)
Saturday, March 29, 2014
Check And Uncheck DataGridView Cell
If DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "P" Then
DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = ""
Else
DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Style.Font = New Font("Wingdings 2", 14, FontStyle.Bold)
DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "P"
End If
DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = ""
Else
DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Style.Font = New Font("Wingdings 2", 14, FontStyle.Bold)
DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "P"
End If
Monday, March 24, 2014
insert update using db class
Frist add --- app.config
and write the code under app.config------
------------------------------
[appSettings ]
[add key ="cont1" value ="server=.;trusted_connection=yes;database=stest" /]
[/appSettings]
------------------------------
###############write the code under db class################and write the code under app.config------
------------------------------
[add key ="cont1" value ="server=.;trusted_connection=yes;database=stest" /]
[/appSettings]
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Public Class db
Public cont As String = ConfigurationSettings.AppSettings("cont1")
Public Function getdata(ByVal myqry As String) As DataTable 'This function use getdata from db
Dim cn As New SqlConnection(cont)
Dim ds As New DataSet
Dim td As New DataTable
Try
Dim da As New SqlDataAdapter(myqry, cn)
da.Fill(ds)
td = ds.Tables(0)
Catch ex As Exception
End Try
Return td
End Function
Public Function excute(ByVal myqry As String) As Boolean 'This function insert,update data in to db
Dim cn As New SqlConnection(cont)
Dim ds As New DataSet
Try
Dim da As New SqlDataAdapter(myqry, cn)
da.Fill(ds)
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
Return True
End Function
End Class
###############################################
Saturday, March 22, 2014
open image in picturebox in vb.net
Dim open As New OpenFileDialog()
open.Filter = "Image Files(*.png; *.jpg; *.bmp)|*.png; *.jpg; *.bmp"
If open.ShowDialog() = DialogResult.OK Then
Dim fileName As String = System.IO.Path.GetFullPath(open.FileName)
PictureBox1.Image = New Bitmap(open.FileName)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
End If
open.Filter = "Image Files(*.png; *.jpg; *.bmp)|*.png; *.jpg; *.bmp"
If open.ShowDialog() = DialogResult.OK Then
Dim fileName As String = System.IO.Path.GetFullPath(open.FileName)
PictureBox1.Image = New Bitmap(open.FileName)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
End If
Tuesday, March 11, 2014
click first column content in datagridview vb.net
If gridshot.Columns(e.ColumnIndex).Name = "Select" Then
Do not Allow Sorting in Data Grid View
Private Sub gridshot_ColumnAdded(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewColumnEventArgs) Handles gridshot.ColumnAdded
gridshot.Columns.Item(e.Column.Index).SortMode = DataGridViewColumnSortMode.NotSortable
End Sub
gridshot.Columns.Item(e.Column.Index).SortMode = DataGridViewColumnSortMode.NotSortable
End Sub
Wednesday, February 12, 2014
Get Day of Week in SQL 2005/2008
select DATENAME(dw,comtype) AS OrderDay from tblcom_type where s_no=6
--Result Friday
--Result Friday
Friday, January 31, 2014
Not allowed special character in vb.net
Private Sub txtto_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtto.KeyPress
Dim ValidInputChar = "#$%^&*,;()[]+{}:'`<>?|~!\/"
If ValidInputChar.Contains(e.KeyChar) Then
e.KeyChar = Nothing
End If
End Sub
Dim ValidInputChar = "#$%^&*,;()[]+{}:'`<>?|~!\/"
If ValidInputChar.Contains(e.KeyChar) Then
e.KeyChar = Nothing
End If
End Sub
Subscribe to:
Posts (Atom)