This commit is contained in:
ms
2019-05-07 17:02:34 +02:00
parent b2f61df354
commit f2d5c20559
46 changed files with 7788 additions and 275 deletions

View File

@@ -1,4 +1,5 @@
Imports System.Data.SqlClient
Imports System.Reflection
Public Class Class1
@@ -11,7 +12,12 @@ Public Class Class1
Public Shared FilePath As String ' = "\\192.168.0.90\f\EDV-Wartung\Dokumentation"
Public Shared Absender As String = "Absender Standard"
Public Shared Sub EnableDoubleBuffered(ByVal dgv As DataGridView)
Dim dgvType As Type = dgv.[GetType]()
Dim pi As PropertyInfo = dgvType.GetProperty("DoubleBuffered",
BindingFlags.Instance Or BindingFlags.NonPublic)
pi.SetValue(dgv, True, Nothing)
End Sub
@@ -166,6 +172,16 @@ Public Class Class1
End Try
End Function
Public Shared Function ip2ipnet(ip As String)
Dim lastbutnotleast As String = "."
Do
ip = ip.Remove((ip.Length - 1), 1)
Loop Until ip.EndsWith(".")
Return ip
End Function
Public Shared Function netmaskseperator(nm As String, ByRef a As Integer, ByRef b As Integer, ByRef c As Integer, ByRef d As Integer, ByRef nwbits As Integer, ByRef hostbits As Integer)
Dim bitstring As String
Try
@@ -319,6 +335,18 @@ Public Class Class1
IPShort = NWAddress
End Function
Public Shared Function getStartEndHost(ByVal ip As String, ByRef starthost As Integer, ByRef endhost As Integer)
Dim Standort, Name, subnetmask As String
Dim nwbits As Integer
Dim nwad As String = IP2ShortNW(ip)
NetzwerkadresseInfo(nwad, Standort, Name, subnetmask)
mask2nwbit(subnetmask, nwbits)
Dim Hostbits As Integer = 32 - nwbits
Dim AnzahlHosts As Integer = (2 ^ Hostbits) - 2
starthost = IP2Host(nwad) + 1
endhost = starthost + (AnzahlHosts - 1)
End Function
Public Shared Function Netzwerkfuellen(NWAdresse As String, NWBits As Integer, Netname As String, NWStandort As String)
Dim con As New SqlConnection
Dim cmd As New SqlCommand
@@ -598,8 +626,8 @@ Public Class Class1
Dim dataadapter As New SqlDataAdapter("SELECT Distinct " & spalte & " from " & Tabelle & "", con)
dataadapter.Fill(ds)
txtbox.AutoCompleteMode = AutoCompleteMode.SuggestAppend
txtbox.AutoCompleteSource = AutoCompleteSource.CustomSource
' txtbox.AutoCompleteMode = AutoCompleteMode.SuggestAppend
' txtbox.AutoCompleteSource = AutoCompleteSource.CustomSource
txtbox.AutoCompleteCustomSource = tmp
For Each dr As DataRow In ds.Tables(0).Rows
@@ -665,4 +693,42 @@ Public Class Class1
End Function
Public Shared Function IsLinked(ByVal IPAdresse As String)
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim reader As SqlDataReader
con.ConnectionString = Class1.DBConString
cmd.Connection = con
Dim Linked As String
con.Open()
cmd.CommandText = "SELECT Linked FROM TbL_Netzwerkclients WHERE IPAdresse = '" & IPAdresse & "' "
reader = cmd.ExecuteReader()
Do While reader.Read
Linked = ReadNullAsEmptyString(reader, "Linked")
'Type = ReadNullAsEmptyString(reader, "Type")
Loop
con.Close()
Return Linked
End Function
Public Shared Function DBNull2emptyString(totest As Object)
If IsDBNull(totest) Then
Return ""
Else
Return totest
End If
End Function
Public Shared Function OrderDataTableby(dt As DataTable, orderby As String)
Dim dv As New DataView(dt)
dv.Sort = orderby
Dim returnTable As DataTable = dv.ToTable
'returnTable = dv.Table
Return returnTable
End Function
End Class