|
Thanks again,
This is what I want to accomplish:
Let's say I have two applications developed in vb.net with sql as database namely fire arms registration and vehicle registration respectively.
these two applications centrally reside on the same server. i want to allow authorized user to access these application through a WEB UI.
For example, if I am way from the office location and I need to use any one of these apps, I can simply login to a web interface and perform any operation i so desire as long I have access privilege.
These applications are executable. it can be installed on a client machine as they are being deployed right now.
there is a need to have these apps available through an URL...
I hope that I am a little clearer now and you can have an idea of my train of thought and process.
Thanks a lot.
|
|
|
|
|
waner michaud wrote: what best solution to use in order to accomplish this task.
ASP.NET
Still sounds like a trick-question. You'd have to write a Web-UI.
Or use something like Citrix.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am Creating a Client that uses email to send and recieve text messages. I only have to problems when i recieve the mail from the server it goes into my listbox but how do i make that listbox string, when selected, open the body of the message in a richtextbox. Here is my code so far.
Also here is a picture of the GUI so you can see the problem a little more clearly.
Click Here For GUI Picture
The messages are put into the Inbox i just cant display the body of the message in the richtext box when selected from the listbox. Any Help will be greatly appreciated! Thanks!
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim strMailServer, strUsername, strPassword, strFrom, strSubject, strToo, strBody, strMailContent As String
Dim popConn As Text_Me_Now.POP3
Dim mailMess As Text_Me_Now.EmailMessage
Dim intMessCnt, i As Integer
strMailServer = "pop.gmx.com"
strUsername = "xxxxxxx@gmx.com"
strPassword = "xxxxxxx"
Button2.Enabled = False
popConn = New Text_Me_Now.POP3
mailMess = New Text_Me_Now.EmailMessage
popConn.POPConnect(strMailServer, strUsername, strPassword)
intMessCnt = popConn.GetMailStat()
If intMessCnt > 0 Then
ListBox1.Items.Clear()
For i = 1 To intMessCnt
strMailContent = popConn.GetMailMessage(i)
strFrom = mailMess.ParseEmail(strMailContent, "From:")
strSubject = mailMess.ParseEmail(strMailContent, "Subject:")
strToo = mailMess.ParseEmail(strMailContent, "To:")
strBody = mailMess.ParseBody()
ListBox1.Items.Add(strFrom & ", " & strSubject)
Next i
End If
popConn.CloseConn()
Button2.Enabled = True
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object,
End Sub
|
|
|
|
|
|
You appear to have extracted all the relevant information for the message, but the only thing you are storing in the ListBox items collection is the from and and subject parts as a single string.
ListBox1.Items.Add(strFrom & ", " & strSubject)
I would suggest that instead of storing this string, that you instead define a class to hold the relevant information.
Something like this:
Public Class MessageItem
Public From As String
Public Body As String
Public Subject As String
Public Sub New(ByVal From As String, ByVal Subject As String, ByVal Body As String)
Me.From = From
Me.Body = Body
Me.Subject = Subject
End Sub
Public Overrides Function ToString() As String
Return From & ", " & Subject
End Function
End Class
Instead of adding items directly to the ListBox, you bind the ListBox to a List(of MessageItem). Define this list at the form level like this:
Private Messages As New List(Of MessageItem)
In the FormLoad event handler, place this statement:
ListBox1.DataSource = Messages
The ToString Function defined in the class will provide the text displayed for the item in the ListBox.
Now in your button_click handler, replace this code:
'call the functions to get the various parts out of the email
strFrom = mailMess.ParseEmail(strMailContent, "From:")
strSubject = mailMess.ParseEmail(strMailContent, "Subject:")
strToo = mailMess.ParseEmail(strMailContent, "To:")
strBody = mailMess.ParseBody()
'add email details to the list box
ListBox1.Items.Add(strFrom & ", " & strSubject)
with this:
Dim msg As New MessageItem(mailMess.ParseEmail(strMailContent, "From:"), _
mailMess.ParseEmail(strMailContent, "Subject:"), _
mailMess.ParseBody())
Messages.Add(msg)
Also replace ListBox1.Items.Clear() with Messages.Clear()
Now in your ListBox1_SelectedIndexChanged method you can set the textbox text with something like this:
RichTextBox1.Text = CType(ListBox1.SelectedItem, MessageItem).Body
|
|
|
|
|
|
|
I'm trying to move disabled accounts in my active directory users OU. I'm getting a error message that says
Error: There is no such object on the server
Code: 80040E37
Source: Active Directory
I created a Test OU on the same level in active directory and I'm not having the same problem. Things work fine.
Error says it's from this line:
Set objRecordset = ObjCommand.Execute
Here's the code I'm using.
*************CODE*************
' Set Flag to enable the disabling and moving of unused accounts otherwise create
' log of accounts affected
' 1 - Will Disable and move accounts
' 0 - Will create ouput log only
bDisable=1
' Accounts that haven't been logged in for this amount of days are selected
iLogonDays=60
' LDAP Location of OUs to search for accounts
' LDAP location format eg: "OU=Users,OU=Test"
strSearchOU="OU=Users"
' Search depth to find users
' Use "OneLevel" for the specified OU only or "Subtree" to search all child OUs as well.
strSearchDepth="OneLevel"
' Location of new OU to move disabled user accounts to
' eg: "OU=Disabled_Accounts,OU=Test"
strNewOU="OU=Disabled_Accounts"
' Log file and error log file path
strLogPath=".\logs\"
' Error log file name appended with date and .err extension)
strErrorLog="DisabledAccounts_"
' Output log file name with date and .log extension)
strOutputLog="DisabledAccounts_"
sDate = Year(Now()) & Right("0" & Month(Now()), 2) & Right("0" & Day(Now()), 2)
Set oFSO=CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(strLogPath) Then CreateFolder(strLogPath)
Set output=oFSO.CreateTextFile(strLogPath & strOutputLog & sDate & ".log")
Set errlog=oFSO.CreateTextFile(strLogPath & strErrorLog & sDate & ".err")
output.WriteLine "Sam Account Name" &vbTab& "LDAP Path" &vbTab& "Last Logon Date" &vbTab& _
"Date Created" &vbTab& "Home Directory"
errlog.WriteLine "Sam Account Name" &vbTab& "LDAP Path" &vbTab& "Problem" &vbTab& "Error"
Set rootDSE = GetObject("LDAP://rootDSE")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set ObjCommand = CreateObject("ADODB.Command")
ObjCommand.ActiveConnection = objConnection
ObjCommand.Properties("Page Size") = 10
DSEroot=rootDSE.Get("DefaultNamingContext")
Set objNewOU = GetObject("LDAP://" & strNewOU & "," & DSEroot)
ObjCommand.CommandText = "<ldap: "="" &="" strsearchou="" ","="" dseroot="" _
"="">;(&(objectClass=User)(objectcategory=Person));adspath;" & strSearchDepth
Set objRecordset = ObjCommand.Execute
On Error Resume Next
While Not objRecordset.EOF
LastLogon = Null
intLogonTime = Null
Set objUser=GetObject(objRecordset.fields("adspath"))
If DateDiff("d",objUser.WhenCreated,Now) > iLogonDays Then
Set objLogon=objUser.Get("lastlogontimestamp")
If Err.Number <> 0 Then
WriteError objUser, "Get LastLogon Failed"
DisableAccount objUser, "Never"
Else
intLogonTime = objLogon.HighPart * (2^32) + objLogon.LowPart
intLogonTime = intLogonTime / (60 * 10000000)
intLogonTime = intLogonTime / 1440
LastLogon=intLogonTime+#1/1/1601#
If DateDiff("d",LastLogon,Now) > iLogonDays Then
DisableAccount objUser, LastLogon
End If
End If
End If
WriteError objUser, "Unknown Error"
objRecordset.MoveNext
Wend
Sub CreateFolder( strPath )
If Not oFSO.FolderExists( oFSO.GetParentFolderName(strPath) ) Then Call _
CreateFolder( oFSO.GetParentFolderName(strPath) )
oFSO.CreateFolder( strPath )
End Sub
Sub DisableAccount( objUser, lastLogon )
On Error Resume Next
If bDisable <> 0 Then
If objUser.accountdisabled=False Then
objUser.accountdisabled=True
objUser.SetInfo
WriteError objUser, "Disable Account Failed"
objNewOU.MoveHere objUser.adspath, "CN="&objUser.CN
WriteError objUser, "Account Move Failed"
Else
Err.Raise 1,,"Account already disabled. User not moved."
WriteError objUser, "Disable Account Failed"
End If
End If
output.WriteLine objUser.samaccountname &vbTab& objUser.adspath &vbTab& lastLogon &vbTab& _
objUser.whencreated &vbTab& objUser.homedirectory
End Sub
Sub WriteError( objUser, strProblem )
If Err.Number <> 0 Then
errlog.WriteLine objUser.samaccountname &vbTab& objUser.adspath &vbTab& strProblem &vbTab& _
Replace(Err.Description,vbCrlf,"")
Err.Clear
End If
End Sub
*********END CODE**********
|
|
|
|
|
You might want to edit your post and put your code inside html PRE tags to make it readable, and hopefully, properly indented.
|
|
|
|
|
Added tags, thank you.
'=================================================================================
' Check all Active Directory accounts to determine what needs to be disabled.
' If LastLogonTimeStamp is Null and object is older than specified date, it is
' disabled and moved. If account has been used, but not within duration specified,
' it is disabled and moved. Does not move already disabled accounts
'==================================================================================
'==================================================================================
' Set Flag to enable the disabling and moving of unused accounts otherwise create
' log of accounts affected
' 1 - Will Disable and move accounts
' 0 - Will create ouput log only
bDisable=1
'=====================================================================================
' Accounts that haven't been logged in for this amount of days are selected
iLogonDays=60
'=======================================================================================
' LDAP Location of OUs to search for accounts
' LDAP location format eg: "OU=Users,OU=Test"
strSearchOU="OU=Users"
'========================================================================================
' Search depth to find users
' Use "OneLevel" for the specified OU only or "Subtree" to search all child OUs as well.
strSearchDepth="OneLevel"
'========================================================================================
' Location of new OU to move disabled user accounts to
' eg: "OU=Disabled_Accounts,OU=Test"
strNewOU="OU=Disabled_Accounts"
'=========================================================================================
' Log file and error log file path
strLogPath=".\logs\"
' Error log file name appended with date and .err extension)
strErrorLog="DisabledAccounts_"
' Output log file name with date and .log extension)
strOutputLog="DisabledAccounts_"
'==========================================================================================
sDate = Year(Now()) & Right("0" & Month(Now()), 2) & Right("0" & Day(Now()), 2)
Set oFSO=CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(strLogPath) Then CreateFolder(strLogPath)
Set output=oFSO.CreateTextFile(strLogPath & strOutputLog & sDate & ".log")
Set errlog=oFSO.CreateTextFile(strLogPath & strErrorLog & sDate & ".err")
output.WriteLine "Sam Account Name" &vbTab& "LDAP Path" &vbTab& "Last Logon Date" &vbTab& _
"Date Created" &vbTab& "Home Directory"
errlog.WriteLine "Sam Account Name" &vbTab& "LDAP Path" &vbTab& "Problem" &vbTab& "Error"
'===========================================================================================
Set rootDSE = GetObject("LDAP://rootDSE")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set ObjCommand = CreateObject("ADODB.Command")
ObjCommand.ActiveConnection = objConnection
ObjCommand.Properties("Page Size") = 10
DSEroot=rootDSE.Get("DefaultNamingContext")
Set objNewOU = GetObject("LDAP://" & strNewOU & "," & DSEroot)
ObjCommand.CommandText = "<LDAP://" & strSearchOU & "," & DSEroot & _
">;(&(objectClass=User)(objectcategory=Person));adspath;" & strSearchDepth
Set objRecordset = ObjCommand.Execute
On Error Resume Next
While Not objRecordset.EOF
LastLogon = Null
intLogonTime = Null
Set objUser=GetObject(objRecordset.fields("adspath"))
If DateDiff("d",objUser.WhenCreated,Now) > iLogonDays Then
Set objLogon=objUser.Get("lastlogontimestamp")
If Err.Number <> 0 Then
WriteError objUser, "Get LastLogon Failed"
DisableAccount objUser, "Never"
Else
intLogonTime = objLogon.HighPart * (2^32) + objLogon.LowPart
intLogonTime = intLogonTime / (60 * 10000000)
intLogonTime = intLogonTime / 1440
LastLogon=intLogonTime+#1/1/1601#
If DateDiff("d",LastLogon,Now) > iLogonDays Then
DisableAccount objUser, LastLogon
End If
End If
End If
WriteError objUser, "Unknown Error"
objRecordset.MoveNext
Wend
Sub CreateFolder( strPath )
If Not oFSO.FolderExists( oFSO.GetParentFolderName(strPath) ) Then Call _
CreateFolder( oFSO.GetParentFolderName(strPath) )
oFSO.CreateFolder( strPath )
End Sub
Sub DisableAccount( objUser, lastLogon )
On Error Resume Next
If bDisable <> 0 Then
If objUser.accountdisabled=False Then
objUser.accountdisabled=True
objUser.SetInfo
WriteError objUser, "Disable Account Failed"
objNewOU.MoveHere objUser.adspath, "CN="&objUser.CN
WriteError objUser, "Account Move Failed"
Else
Err.Raise 1,,"Account already disabled. User not moved."
WriteError objUser, "Disable Account Failed"
End If
End If
output.WriteLine objUser.samaccountname &vbTab& objUser.adspath &vbTab& lastLogon &vbTab& _
objUser.whencreated &vbTab& objUser.homedirectory
End Sub
Sub WriteError( objUser, strProblem )
If Err.Number <> 0 Then
errlog.WriteLine objUser.samaccountname &vbTab& objUser.adspath &vbTab& strProblem &vbTab& _
Replace(Err.Description,vbCrlf,"")
Err.Clear
End If
End Sub
|
|
|
|
|
Sorry, it's been a busy day at work...
When you search AD, you need to search in a Container, not an OrganizationalUnit. Change your strSearchOU from "OU=Users" to "CN=Users" .
|
|
|
|
|
|
Now I've run into another issue, I get this error when running the script.
User LDAP://CN=First Last,CN=Users,DC=Domain, DC=local Get LastLogon Failed. The directory property cannot be found in the cache.
|
|
|
|
|
I am making text to speech converter in vb.net. I want a sliding volume button for the volume adjustment, I have tried it but its not working and I want one button which works for both pause/resume together with a timer that shows how much the time is taken in reading text. Please help me with simple and easy codes it would solve my problem because its my project and here is my code for tts:
Public Class FormTTS
Public SAPI = CreateObject("SAPI.spVoice")
Public Paused As Boolean = False
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
Const KEYEVENTF_KEYUP As Long = &H2
Private Sub btnread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnread.Click
SAPI.Speak(TextBox1.Text, 3)
TextBox2.Text = "0"
Timer1.Interval = 500
Timer1.Enabled = True
If TextBox1.Text = "" Then
MessageBox.Show("You didn't fill in the fields!")
End If
End Sub
Private Sub btnpause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnpause.Click
If Paused = False Then
SAPI.Pause()
Paused = True
ElseIf Paused = True Then
SAPI.Pause()
Paused = False
End If
Timer1.Enabled = False
End Sub
Private Sub btnstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstop.Click
SAPI.Speak(vbNullString, 2)
End Sub
Private Sub btnresume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnresume.Click
SAPI.Resume()
Timer1.Enabled = True
End Sub
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
Dim Response As Integer
Response = MsgBox("Are You Sure You Want To Close The Program", vbYesNo, "Exit")
If Response = vbYes Then
Close()
Else
Me.Show()
End If
End Sub
Private Sub btnvol_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnvol.Click
Call keybd_event(System.Windows.Forms.Keys.R, 0, 0, 0) 'R down
Call keybd_event(System.Windows.Forms.Keys.R, 0, KEYEVENTF_KEYUP, 0) 'R up
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox2.Text = CInt(TextBox2 .Text) + 1
End Sub
End Class
|
|
|
|
|
Hey,
is there a thing to do httpwebrequest trought a socks 5 proxy ?
Sorry for my english :-S
Regrads
|
|
|
|
|
|
I wish to design a small application to read very lengthy datas in a single page with scrollable manner...
I mean, in single page 3-Datagridviews and some pages of text needed to read from a split container....
For that I wish to have a lenghty form to achieve it in a single page through scroll bar...
Does any body can show the details..... VS-2010
Thanks
|
|
|
|
|
The DataGridView has something called "virtual mode". Instead of databinding (and the overhead), it simply requests the values that should be on-screen. That means that you can display the first records immediately after loading them. There's a walkthrough[^] on MSDN.
For it to work nicely, you'd load your data on a separate thread, using a reader, and synchronize every now and then (every second or every 100 items).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks Eddy....All your helps are very much useful....
Thanks Again from Paramu @ Paranthaman
|
|
|
|
|
My pleasure, and thanks for the kind words
|
|
|
|
|
Dear Sir,
How to maximize MDIParent and MDIChild with it control to fix in any monitor size.
|
|
|
|
|
I assume that you are talking about the forms.
If so then just set the windowstate property in each form to maximized.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
I'm looking for a vbscript to disable local (XP & Win 7) accounts that haven't been accessed in the last 60 days.
|
|
|
|
|
There's an example here[^]; it's asp, so you'd have to translate it to vbscript.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks a lot Eddy. I'm not much of a translator, so I kept looking and found this it works great.
***************CODE*******************
Option Explicit
Dim objNetwork, strComputer, objComputer, objUser, dtmLast
' Bind to the local computer.
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("WinNT://" & strComputer & ",computer")
' Enumerate all users.
objComputer.Filter = Array("user")
For Each objUser In objComputer
' Trap error if user never logged in.
On Error Resume Next
dtmLast = objUser.lastLogin
If (Err.Number <> 0) Then
dtmLast = #1/1/1970#
End If
On Error GoTo 0
' Check if last logon was more than 30 days in the past.
If (DateDiff("d", dtmLast, Now()) > 60) Then
' Disable the user.
objUser.AccountDisabled = True
objUser.SetInfo
End If
Next
***************CODE*******************
|
|
|
|
|