Dim strWhere as String = ""
strWhere = "{qryLoan.IssueDate} IN #" & dtpBegDate.Value & "# TO #" & dtpEndDate.Value & "# "
mReport.Load("..\Reports\loan.rpt")
mReport.RecordSelectionFormula = strWhere
Here I am generating report using query called "qryLoan" and vaule selection form column called "IssueDate" in between "dtpBegDate" to "dtpEndDate" using datetimepicker controls. hope this will help those who are unable to solve the problem.
any question just comment it. thanks.
Search This Blog
Saturday, 16 July 2011
Convert Number to Roman number in VB.Net
Convert Number to Roman number in VB.Net
Dim Roman As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
'RomanNumber(CInt(txtNumber.Text))
lblRoman.Text = ""
RomanNumber(CInt(InputBox("Please enter the number")))
lblRoman.Text = Roman
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Function RomanNumber(ByVal Number As Integer) As String
Try
Do While Number > 0
Select Case Number
Case Is >= 1000
Roman &= "M"
Number -= 1000
Case Is >= 900
Roman &= "CM"
Number -= 900
Case Is >= 500
Roman &= "D"
Number -= 500
Case Is >= 400
Roman &= "CD"
Number -= 400
Case Is >= 100
Roman &= "C"
Number -= 100
Case Is >= 90
Roman &= "XC"
Number -= 90
Case Is >= 50
Roman &= "L"
Number -= 50
Case Is >= 40
Roman &= "XL"
Number -= 40
Case Is >= 10
Roman &= "X"
Number -= 10
Case 9
Roman &= "IX"
Number -= 9
Case 5 To 8
Roman &= "V"
Number -= 5
Case 4
Roman &= "IV"
Number -= 4
Case 1 To 3
Roman &= "I"
Number -= 1
End Select
Loop
Return Roman
Catch ex As Exception
MessageBox.Show(ex.Message, "Emint msgbox...!")
End Try
End Function
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
'RomanNumber(CInt(txtNumber.Text))
lblRoman.Text = ""
RomanNumber(CInt(InputBox("Please enter the number")))
lblRoman.Text = Roman
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Function RomanNumber(ByVal Number As Integer) As String
Try
Do While Number > 0
Select Case Number
Case Is >= 1000
Roman &= "M"
Number -= 1000
Case Is >= 900
Roman &= "CM"
Number -= 900
Case Is >= 500
Roman &= "D"
Number -= 500
Case Is >= 400
Roman &= "CD"
Number -= 400
Case Is >= 100
Roman &= "C"
Number -= 100
Case Is >= 90
Roman &= "XC"
Number -= 90
Case Is >= 50
Roman &= "L"
Number -= 50
Case Is >= 40
Roman &= "XL"
Number -= 40
Case Is >= 10
Roman &= "X"
Number -= 10
Case 9
Roman &= "IX"
Number -= 9
Case 5 To 8
Roman &= "V"
Number -= 5
Case 4
Roman &= "IV"
Number -= 4
Case 1 To 3
Roman &= "I"
Number -= 1
End Select
Loop
Return Roman
Catch ex As Exception
MessageBox.Show(ex.Message, "Emint msgbox...!")
End Try
End Function
End Class
Sunday, 8 May 2011
Adding bulk of users into AD (active directory) from CSV file vbscript
Adding bulk of users into AD (active directory) from CSV file. It’s best to execute these scripts from a domain controller while logged in with administrative credentials. I’m assuming that users details you can get a comma-separate value (CSV) . Save CSV file on correct location example "C:\vbScripts\".
CSV file example:
Vbscript:
Option Explicit
Dim sCSVFileLocation
Dim sCSVFile
Dim objFSO
Dim objFile
Dim strLine
Dim strItems
Dim oNewUser
' ———-LDAP connection variables———-
Dim oRootLDAP
Dim oContainer
Dim objRootLDAPg, objGroup, objUser, objOU
Dim strOU, strGroup, strDNSDomain
Dim intCounter
' ———-Other variables——————–
Dim sGivenName
Dim sInitials
Dim sSurName
Dim sDescription
Dim sDepartment
Dim nPwdLastSet
Dim nUserAccountControl
Dim sDomain
' ———-Modify this to match your company’s AD domain———-
sDomain="firemonkey.net"
' ———-Input file location———-
sCSVFileLocation = "C:\ScriptS\"
' ———-Full path to input file———-
sCSVFile = sCSVFileLocation&"test.csv"
'Wscript.Echo sCSVFile
' ———-Commands used to open the CSV file and select all of the records———-
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile(sCSVFile, 1)
' ———-Create a connection to the Active Directory Users container.———-
Set oContainer = GetObject("LDAP://OU=Test,dc=firemonkey,dc=net")
' ———-Allows processing to continue even if an error occurs (i.e. dup user)———-
on error resume next
Do Until objFile.AtEndOfStream ' Reads the values (cells) in the sInputFile file.
' ——— Start creating user account———-
' Read variable information from the CSV file
' and build everything needed to create the account
strLine = objFile.ReadLine
strItems = split(strLine,",")
sGivenName = strItems(0)
sInitials = strItems(1)
sSurName = strItems(2)
sDescription = strItems(3)
sDepartment = strItems(4)
nPwdLastSet = strItems(5)
nUserAccountControl = strItems(6)
' ———-Build the User account———-
Set oNewUser = oContainer.Create("User","cn="&sGivenName)
oNewUser.put "givenName",sGivenName
oNewUser.put "initials",sInitials
oNewUser.put "sn",sSurName
oNewUser.put "Description",sDescription
oNewUser.put "Department",sDepartment
' ———-Write this information into Active Directory so we can———-
' modify the password and enable the user account
oNewUser.SetInfo
' ———-Change the users password———-
oNewUser.Put "pwdLastSet",nPwdLastSet
' ———-Enable the user account———-
oNewUser.Put "userAccountControl", nUserAccountControl
oNewUser.SetInfo
Loop
objFile.Close
Wscript.Echo "All accounts are successfully copied!!!"
' ——— End of user account creation———-
' ——— Add users into students group———-
strOU = "OU=Group2,"
strGroup = "CN=Students,"
' Bind to Active Directory and get LDAP name
Set objRootLDAP = GetObject("LDAP://RootDSE")
strDNSDomain = objRootLDAPg.Get("DefaultNamingContext")
' Prepare the OU and the Group
Set objGroup = GetObject("LDAP://"& strGroup & strOU & strDNSDomain)
Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
' On Error Resume next
intCounter = 1
For Each objUser In objOU
If objUser.Class = lcase("User") then
objGroup.add(objUser.ADsPath)
intCounter = intcounter +1
End If
Next
WScript.Echo strGroup & " has " & intCounter & " new members"
Wscript.Quit
CSV file example:
Vbscript:
Option Explicit
Dim sCSVFileLocation
Dim sCSVFile
Dim objFSO
Dim objFile
Dim strLine
Dim strItems
Dim oNewUser
' ———-LDAP connection variables———-
Dim oRootLDAP
Dim oContainer
Dim objRootLDAPg, objGroup, objUser, objOU
Dim strOU, strGroup, strDNSDomain
Dim intCounter
' ———-Other variables——————–
Dim sGivenName
Dim sInitials
Dim sSurName
Dim sDescription
Dim sDepartment
Dim nPwdLastSet
Dim nUserAccountControl
Dim sDomain
' ———-Modify this to match your company’s AD domain———-
sDomain="firemonkey.net"
' ———-Input file location———-
sCSVFileLocation = "C:\ScriptS\"
' ———-Full path to input file———-
sCSVFile = sCSVFileLocation&"test.csv"
'Wscript.Echo sCSVFile
' ———-Commands used to open the CSV file and select all of the records———-
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile(sCSVFile, 1)
' ———-Create a connection to the Active Directory Users container.———-
Set oContainer = GetObject("LDAP://OU=Test,dc=firemonkey,dc=net")
' ———-Allows processing to continue even if an error occurs (i.e. dup user)———-
on error resume next
Do Until objFile.AtEndOfStream ' Reads the values (cells) in the sInputFile file.
' ——— Start creating user account———-
' Read variable information from the CSV file
' and build everything needed to create the account
strLine = objFile.ReadLine
strItems = split(strLine,",")
sGivenName = strItems(0)
sInitials = strItems(1)
sSurName = strItems(2)
sDescription = strItems(3)
sDepartment = strItems(4)
nPwdLastSet = strItems(5)
nUserAccountControl = strItems(6)
' ———-Build the User account———-
Set oNewUser = oContainer.Create("User","cn="&sGivenName)
oNewUser.put "givenName",sGivenName
oNewUser.put "initials",sInitials
oNewUser.put "sn",sSurName
oNewUser.put "Description",sDescription
oNewUser.put "Department",sDepartment
' ———-Write this information into Active Directory so we can———-
' modify the password and enable the user account
oNewUser.SetInfo
' ———-Change the users password———-
oNewUser.Put "pwdLastSet",nPwdLastSet
' ———-Enable the user account———-
oNewUser.Put "userAccountControl", nUserAccountControl
oNewUser.SetInfo
Loop
objFile.Close
Wscript.Echo "All accounts are successfully copied!!!"
' ——— End of user account creation———-
' ——— Add users into students group———-
strOU = "OU=Group2,"
strGroup = "CN=Students,"
' Bind to Active Directory and get LDAP name
Set objRootLDAP = GetObject("LDAP://RootDSE")
strDNSDomain = objRootLDAPg.Get("DefaultNamingContext")
' Prepare the OU and the Group
Set objGroup = GetObject("LDAP://"& strGroup & strOU & strDNSDomain)
Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
' On Error Resume next
intCounter = 1
For Each objUser In objOU
If objUser.Class = lcase("User") then
objGroup.add(objUser.ADsPath)
intCounter = intcounter +1
End If
Next
WScript.Echo strGroup & " has " & intCounter & " new members"
Wscript.Quit
Substitution Ciphers
A substitution cipher uses a fixed rule for which letters get substituted for other letters, e.g.
the Caesar cipher
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
so for example "THEBRITONSAREREVOLTING" has the ciphertext "WKHCULWRQVDUHUHYROWLQJ".
This particular cipher is also known as a shift cipher (where each letter gets shifted by a fixed number of letters).
Wednesday, 9 February 2011
U08071- Week one
It's important that I gain group work experience, and the CO-OP work term is definitely providing that. But I've already discovered that there's more to CO-OP than just group work experience. I like that, this module has been recognized as key module in computer science and as well as in real world, and it has encouraged me to participate many different types of activities. I am hopeful that these knowledge will be really useful in my future career.
Subscribe to:
Comments (Atom)
