|
I am writing a new C# 2010 desktop applicaton. I am using some of the exsting code in another C# 2010 application to start the new application since I will be using alot of existing code that works. I basically want to have a desktop form where the user can enter some data and return to the statement after 'Application.Run(new RejectForm());' listed below.
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new RejectForm());
}
I would like to have the data that was entered in the form be available to the application at this point.
Thus can you tell me the following:
1. How can I return to the location right after the Application.Run(new RejectForm()); statement?
2. How can i have the values that were entered on the windows form be available for the rest of the application to access from this point?
|
|
|
|
|
Not sure I understand fully, but here goes. Application.Run sets up the message loop which 'runs' the form, so when the form is closed that statement ends. Normally the application terminates there as well.
If you want to do some post processing create properties or retrieval methods on the form then just access them after the Run method has completed. When main() ends, so does your application.
Regards,
Rob Philpott.
|
|
|
|
|
static void Main(string[] args)
{
using (var f = new RejectForm())
{
if (DialogResult.OK == f.ShowDialog())
{
string someValue = f.TheValue;
}
else
{
}
}
}
You'd need public properties in your RejectForm , similar to the code below;
public class RejectForm: Form
{
public string TheValue
{
get { return theValueTextBox.Text; }
}
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How would you incorporate the code you listed above in the windows form and then have the code return to the main method?
|
|
|
|
|
classy_dog wrote: How would you incorporate the code you listed above in the windows form The first part goes into "Program.cs"; you can see the Main-method. The second part of the code goes in the form you're trying to show.
classy_dog wrote: and then have the code return to the main method? That would happen automatically; when an application is run, the Main-method is executed. The code as presented would display a form (modal), and continue execution on the line after the "ShowDialog" call, as soon as the form closes.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
There is one more thing to that. You would have to put
DialogResult.OK; when you want to close Form, in order to
DialogResult.OK == f.ShowDialog() be true.
Best regards,
|
|
|
|
|
As specified in above comment, I neglect to mention I'm assuming an "OK-button" on your form, with the property "DialogResult" set to "OK".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi folks,
What I need is some guidance on what .NET namespaces o classes or whatever may be helpful to accomplish what I need to build.
Basically I have to build an Desktop (or Web) application capable of loading a C# Windows Form file and display it to the user just like (or similar as) we developers see it in the VS Designer.
Once open, the user must be able to click on any of the visual controls and set some properties for the the control. These properties are not the native control properties we set at design-time but specific properties of my application (e.g. user-role allowed to see that control when the form is executed).
Hopefully I explained well enough for you to get the idea.
I'll really appreciate your help.
Thank you
-FJ
|
|
|
|
|
CodeProject has an article[^] on the subject
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thank you for the quick response Eddy.
I'll check it out and hopefully it will be of good help.
Although I'm seeing the files it loads/saves are in a proprietary format, not the regular .cs files we load within VS.
Anyway I'll check it out.
Thanks again.
-FJ
|
|
|
|
|
Take it from somebody who has just done this, it is NOT a simple task, not by a long shot.
While it is true that you can make a rudimentary designer and save it to a proprietary format, if you want to be able to load .cs and .vb files, edit them, then save back to .cs or .vb then you need a LOT more back end. You need to make CodeDOM serializers, Parsers, resource services, event binding services, toolbox services, type resolution services, undo/redo frameworks, etc. My forms designer is probably 10k lines of code and took a lot of headaches and back-and-forth to get to where it is.
The biggest help I can give is to look at open source IDE's like SharpDevelop and MonoDevelop and see how they implemented them. Be wary though, the code can be very difficult to understand because of the way they intermingle with the IDE. It will give you a base on which to go though.
Good luck, trust me you'll need it.
|
|
|
|
|
Thank you Ron.
No doubt at all that it will take A LOT of HARD work to get it done just like you describe it.
My hope was (or is) that since I only need to load a .cs and paint it on screen to allow the user to click and select the visual controls to specify, for example, what user-role can see that control when the actual form is executed, the work required won't be that complex. The user won't be able to change anything on the loaded form itself. He will just set some properties that I'll save in a database, so when the form is executed I'll query the database to act according to the properties specified by the user (e.g. show/hide controls according to user-roles).
Thank you for your advise and good wishes ;o)
-FJ
|
|
|
|
|
If you just want to set some properties of a control and save it for use later that's a different approach, you don't need to design a forms designer for that, just implement a property window using the built-in PropertyGrid control, then save the edited property values to the database. You can google for C# Moveable Controls and stuff like that, searching on Forms Designer will probably point you in the wrong direction.
|
|
|
|
|
Maybe I wasn't clear enough in my first post, but yes, I don't need to build an application to design forms. What I do need is an application that can load and show on screen real .CS forms created by a developer. And administrator user will be the one using this application. What for? to set some, for example, user-role permissions for any of the visual controls of the form so the final user will or will not be able to see or access those controls when he, the final user, execute that form.
So, even though I don't need my app to be able to design forms just like the VS IDE does, I do need it to be able to load/show real VS Forms in a kind-of-designer window that let the Administrator User set privacy properties (using a PropertyGrid of course) for the buttons, textboxes, etc, in that form.
I hope it is clearer now.
And again, I appreciate your help.
-FJ
|
|
|
|
|
Hi,
I am developing a keyboard for using C#. I want to know how can I make the Backspace button invoke a Backspace, Delete button invoke a Delete, etc...
Technology News @ www.JassimRahma.com
|
|
|
|
|
I would guess that when you press the backspace button it sends a message containing the key code for Backspace. But your question is not entirely clear.
Use the best guess
|
|
|
|
|
|
Hey guys, Here's the dead,
I have different Brands, and each brand has its own color, I keep the code for the color in database, When I load the page for each brand I want this color to be applied to different parts
for example the Category Header
#CategoryHeader {
background-color:#ff6a00;
}
Since the color can be changed any time I cannot use
bodyId.Attributes["class"] = "test";
.test
{
background-color: #000000 !important;
}
any help is appreciated
Thanx
|
|
|
|
|
Actually you need different style sheets for your different brands (they could be generated from the data in your database). That style sheet should be the last style sheet to be loaded by your page.
|
|
|
|
|
Hi, i'm new on c#, i have a code from another post, i need to convert to c#, somebody can help me?
'***************************************************************************
'*
'* Delete Profiles script written by Joe Shonk ( joe@theshonkproject.com)
'* Version 1.9
'*
'* Syntax: cscript.exe DeleteProfiles.vbs [/H] [/E | /I <profilename>] [/C] [/R]
'* [/D <days>] [/L <filename>] [/V]
'*
'* This script is provided as-is, no warrenty is provided or implied.
'* The author is NOT responsible for any damages or data loss that may occur
'* through the use of this script. Always test, test, test before
'* rolling anything into a production environment.
'*
'* This script is free to use for both personal and business use, however,
'* it may not be sold or included as part of a package that is for sale.
'*
'* A Service Provider may include this script as part of their service
'* offering/best practices provided they only charge for their time
'* to implement and support.
'*
'* For distribution and updates go to: http://www.theshonkproject.com
'*
'***************************************************************************
On Error Resume Next
Const DeleteReadOnly = TRUE
Const HKEY_LOCAL_MACHINE = &H80000002
Const SIDExclusionList = "|S-1-5-18|S-1-5-19|S-1-5-20|"
'***************************************************************************
'* To add your own profiles to the exclusion list simply add the
'* account to the end of the strProfileExclusionList. Note: Each account
'* is delimited by a | (pipe) and is all lowercase
'*
Dim strProfileExclusionList
Dim strComputer, strLogFileName, strDocAndSettingsLocation
Dim strKeyPath, arrValueNames, arrValueTypes, arrSubKeys
Dim i, strHiveExclusionList, strHiveOpenSkipped, strHiveValue
Dim strSubKey, strGuid, strUserName, strProfileImagePath
Dim dwProfileExclusion, dwSIDExclusion, dwHiveOpenExclusion
Dim flgLogFile, flgWriteConsole, flgVerboseLog, flgAllowExecute, flgHelp
Dim dwArgCount, strNextArg, strCurrentArg, flgCustomExclusions, flgCustomExMatch
Dim strCustomExclusions, dateCurrentTime, flgCustomInclusions, strCustomInclusions
Dim flgCustomInMatch, flgExDateMatch, flgDateExclusion, dwDateExclusion
strComputer = "."
strProfileExclusionList = "|administrator|all users|default user|localservice|networkservice|public|ctx_smauser|ctx_cpuuser|ctx_cpsvcuser|ctx_streamingsvc|ctx_configmgr|"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
strLogFileName = ""
dateCurrentTime = now()
dwArgCount = 0
flgHelp = False
flgLogFile = False
flgCustomExclusions = False
flgWriteConsole = False
flgVerboseLog = False
flgAllowExecute = True
dwArgCount = objArgs.Count
For i = 0 to dwArgCount - 1
strCurrentArg = lcase(objArgs(i))
Select Case strCurrentArg
Case "-v", "-verbose", "/v", "/verbose"
flgVerboseLog = True
Case "-c", "-console", "/c", "/console"
flgWriteConsole = True
Case "-r", "-readonly", "-read", "/r", "/readonly", "/read"
flgAllowExecute = False
flgWriteConsole = True
Case "-l", "-log", "/l", "/log"
If i < (dwArgCount - 1) then
strNextArg = lcase(objArgs(i + 1))
If (left(strNextArg, 1) <> "/") and (left(strNextArg, 1) <> "-") then
flgLogFile = True
strLogFileName = strNextArg
i = i + 1
Else
wscript.echo "Warning: Log Switch Used but No Log Filename Specified."
End if
Else
wscript.echo "Warning: Log Switch Used but No Log Filename Specified."
End if
Case "-e", "-exclude", "/e", "/exclude"
If i < (dwArgCount - 1) then
strNextArg = lcase(objArgs(i + 1))
If (left(strNextArg, 1) <> "/") and (left(strNextArg, 1) <> "-") then
flgCustomExclusions = True
strCustomExclusions = replace(strNextArg, ",", "|", 1)
i = i + 1
Else
wscript.echo "Error: Exclude Switch Used but no Argument Specified."
flgHelp = True
End if
Else
wscript.echo "Error: Exclude Switch Used but no Argument Specified."
flgHelp = True
End if
Case "-i", "-include", "/i", "/include"
If i < (dwArgCount - 1) then
strNextArg = lcase(objArgs(i + 1))
If (left(strNextArg, 1) <> "/") and (left(strNextArg, 1) <> "-") then
flgCustomInclusions = True
strCustomInclusions = replace(strNextArg, ",", "|", 1)
i = i + 1
Else
wscript.echo "Error: Include Switch Used but no Argument Specified."
flgHelp = True
End if
Else
wscript.echo "Error: Include Switch Used but no Argument Specified."
flgHelp = True
End if
Case "-d", "-days", "-day", "/d", "/days", "/day"
If i < (dwArgCount - 1) then
strNextArg = lcase(objArgs(i + 1))
If (left(strNextArg, 1) <> "/") and (left(strNextArg, 1) <> "-") then
dwDateExclusion = cdbl(strNextArg)
i = i + 1
If (dwDateExclusion > 0) and (dwDateExclusion < 999999) then
flgDateExclusion = True
Else
flgHelp = True
wscript.echo "Error: Invalid Number of Days Specified."
End if
Else
wscript.echo "Error: Day Switch Used but no Argument Specified."
flgHelp = True
End if
Else
wscript.echo "Error: Day Switch Used but no Argument Specified."
flgHelp = True
End if
Case "-h", "-help", "/h", "/help", "-?", "/?"
flgHelp = True
Case Else
wscript.echo "Unrecognized option: " & objArgs(i)
flgHelp = True
End Select
next
If flgCustomExclusions and flgCustomInclusions then
wscript.echo "Error: Cannot Specify a Custom Exclusion List with a Custom Inclusion List."
flgHelp = True
End if
If flgHelp then
wscript.echo "Help"
wscript.echo ""
wscript.echo "DeleteProfiles.vbs - v1.9"
wscript.echo "-------------------------"
wscript.echo ""
wscript.echo "cscript.exe DeleteProfiles.vbs [/H] [/E | /I <profilename>] [/C] [/R]"
wscript.echo " [/D <days>] [/L <filename>] [/V]"
wscript.echo ""
wscript.echo "Command Line Options:"
wscript.echo " /C : Write Log to the Console"
wscript.echo " /D <days> : Delete Profiles Older than x Days"
wscript.echo " /E <profile> : Exclude Profiles from Deletion"
wscript.echo " : Wildcard * Supported. Use ',' or '|' as a Delimiter for"
wscript.echo " : Multiple Entries. No Spaces Between Entries."
wscript.echo " /I <profile> : Only Delete Included Profiles (Wildcard * Supported)"
wscript.echo " : Wildcard * Supported. Use ',' or '|' as a Delimiter for"
wscript.echo " : Multiple Entries. No Spaces Between Entries."
wscript.echo " /L <filename> : Create Log File"
wscript.echo " /H : Help (This Screen)"
wscript.echo " /R : Run Script in Read Only Mode (No System Changes)"
wscript.echo " /V : Verbose Logging"
wscript.echo ""
wscript.quit
End if
If flgLogFile then Set objLogFile = objFSO.CreateTextFile(strLogFileName)
WriteHeader
'**********************************************************************************
'* Enumerate a list of loaded Registry Hives. Delimited by the | character
strHiveExclusionList = "|"
strHiveOpenSkipped = "|"
strKeyPath = "SYSTEM\CurrentControlSet\Control\hivelist"
objReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes
For i=0 To UBound(arrValueNames)
strHiveValue = trim(arrValueNames(i))
strHiveExclusionList = strHiveExclusionList & Right(strHiveValue, len(strHiveValue) - instrrev(strHiveValue, "\")) & "|"
Next
'**********************************************************************************
'* Enumerate a list of known profiles from the registry
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
'**********************************************************************************
'* Parse through the Profile list and Delete the Registry entries and Files associated to the Profile
'* Provided the profile is not listed in an Exclusion list
WriteLog "Checking Profile List"
WriteLog "---------------------"
If NOT flgAllowExecute then WriteLog "READ ONLY MODE. No changes made."
If flgDateExclusion then WriteLog "Purge Profiles Older than " & dwDateExclusion & " Days."
WriteLog ""
For Each subkey In arrSubKeys
strSubKey = ""
strGuid = ""
strUserName = ""
strProfileImagePath = ""
strSubKey = trim(subkey)
If (instr(SIDExclusionList, "|" & strSubKey & "|") = 0) and (strSubKey <> "") then
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & strSubKey
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"Guid", strGuid
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"ProfileImagePath", strProfileImagePath
strUserName = Right(strProfileImagePath, len(strProfileImagePath) - instrrev(strProfileImagePath, "\"))
WriteLog "Profile"
If flgVerboseLog then WriteLog " SID : " & strSubKey
If flgVerboseLog then WriteLog " GUID : " & strGuid
WriteLog " Profile Path: " & strProfileImagePath
WriteLog " UserName : " & strUserName
dwProfileExclusion = instr(strProfileExclusionList, "|" & trim(lcase(strUserName)) & "|")
dwSIDExclusion = instr(strHiveExclusionList, "|" & strSubKey & "|")
If flgCustomExclusions then
flgCustomExMatch = TestCase(lcase(strUserName), lcase(strCustomExclusions))
If flgCustomExMatch then
strProfileExclusionList = strProfileExclusionList & trim(lcase(strUserName)) & "|"
dwProfileExclusion = 1
End if
End if
If flgCustomInclusions then
flgCustomInMatch = TestCase(lcase(strUserName), lcase(strCustomInclusions))
If flgCustomInMatch = 0 then
strProfileExclusionList = strProfileExclusionList & trim(lcase(strUserName)) & "|"
dwProfileExclusion = 1
End if
End if
If flgDateExclusion then
flgExDateMatch = 0
If objFSO.FileExists(strProfileImagePath & "\NTUSER.DAT") then
Set objFile = objFSO.GetFile(strProfileImagePath & "\NTUSER.DAT")
flgExDateMatch = TestDateExclusion(objFile.DateLastModified, DateCurrentTime, dwDateExclusion)
Else
WriteLog " NTUSER.DAT Does not Exist"
If objFSO.FileExists(strProfileImagePath & "\NTUSER.MAN") then
WriteLog " NTUSER.MAN Found"
Set objFile = objFSO.GetFile(strProfileImagePath & "\NTUSER.MAN")
flgExDateMatch = TestDateExclusion(objFile.DateLastModified, DateCurrentTime, dwDateExclusion)
Else
WriteLog " NTUSER.MAN Does not Exist"
End if
End if
If flgExDateMatch then
strProfileExclusionList = strProfileExclusionList & trim(lcase(strUserName)) & "|"
dwProfileExclusion = 1
End if
End if
If (dwProfileExclusion = 0) and (dwSIDExclusion = 0) then
WriteLog " Profile OK to Delete"
If flgDateExclusion then WriteLog " Profile Matches Age Requirement"
If flgCustomInclusions and flgCustomInMatch then WriteLog " Profile Matches Inclusion List"
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & strSubKey
DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\" & strSubKey
DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\" & strSubKey
DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\" & strSubKey
DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
If strGuid <> "" then
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\PolicyGuid\" & strGuid
DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileGuid\" & strGuid
DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
Else
WriteLog " Guid is Blank, Deleting Registry Keys based of Guid has been skipped."
End if
If objFSO.FolderExists(strProfileImagePath) then
WriteLog " Folder Exists - Deleting"
If flgAllowExecute then objFSO.DeleteFolder(strProfileImagePath), DeleteReadOnly
Else
WriteLog " Folder Does not Exist"
End if
Else
If dwProfileExclusion then
WriteLog " Profile not Deleted --- Username in Profile Exclusion List"
If flgCustomExclusions and flgCustomExMatch then _
WriteLog " Profile not Deleted --- Username Matched Custom Exclusion List"
If flgCustomInclusions and (flgCustomInMatch = 0) then _
WriteLog " Profile not Deleted --- Username Did not Match Custom Inclusion List"
If flgDateExclusion and flgExDateMatch then _
WriteLog " Profile not Deleted --- Profile is not Older than " & dwDateExclusion & " Days"
End if
If dwSIDExclusion then
WriteLog " Profile not Deleted --- User Hive is currently loaded"
strHiveOpenSkipped = strHiveOpenSkipped & trim(lcase(strUserName)) & "|"
End if
End if
End if
Next
'**********************************************************************************
'* Get Document and Settings Directory Location from the Registry
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"ProfilesDirectory", strDocAndSettingsLocation
WriteLog ""
WriteLog "Documents and Settings Path: " & strDocAndSettingsLocation
WriteLog ""
WriteLog "Checking For Orphaned Profile Directories"
WriteLog "-----------------------------------------"
Set objFolder = objFSO.GetFolder(strDocAndSettingsLocation)
Set colSubfolders = objFolder.Subfolders
'**********************************************************************************
'* Parse through the directory a check For orphaned profile folders and Delete
For Each objSubfolder in colSubfolders
strUserName = lcase(Right(objSubfolder.Path, len(objSubfolder.Path) - instrrev(objSubfolder.Path, "\")))
dwProfileExclusion = instr(strProfileExclusionList, "|" & trim(lcase(strUserName)) & "|")
dwHiveOpenExclusion = instr(strHiveOpenSkipped, "|" & trim(lcase(strUserName)) & "|")
If (dwProfileExclusion = 0) and (dwHiveOpenExclusion = 0) then
WriteLog "Deleting Orphaned Profile Directory: " & objSubfolder.Path
If flgAllowExecute then objFSO.DeleteFolder(objSubfolder.Path), DeleteReadOnly
Else
If dwHiveOpenExclusion then
WriteLog "Hive Loaded -- Skippped Delete: " & objSubfolder.Path
End if
If dwProfileExclusion then
WriteLog "Profile Excluded -- Skippped Delete: " & objSubfolder.Path
End if
End if
Next
WriteFooter
If flgLogFile then objLogFile.Close
objReg = Nothing
objFSO = Nothing
objArgs = Nothing
'**********************************************************************************
'* Deletes All Subkeys and Values within a Given Registry Key
Sub DeleteKey(dwHiveType, strDeleteKeyPath)
Dim dwReturn, arrDeleteSubKeys, strDeleteSubKey
dwReturn = objReg.EnumKey(dwHiveType, strDeleteKeyPath, arrDeleteSubKeys)
If (dwReturn = 0) And IsArray(arrDeleteSubKeys) Then
For Each strDeleteSubKey In arrDeleteSubKeys
DeleteKey dwHiveType, strDeleteKeyPath & "\" & strDeleteSubKey
Next
End if
If flgAllowExecute then objReg.DeleteKey dwHiveType, strDeleteKeyPath
If flgVerboseLog then WriteLog " Deleting: " & strDeleteKeyPath
End Sub
'**********************************************************************************
'* Test a List of Wildcard Items Against a Value
Function TestCase(strTestCase, strWildCardTests)
TestCase = 0
dwAllItems = 0
dwSoftLeft = 0
dwSoftRight = 0
arrWildCards = split(strWildCardTests, "|")
For each strWildCard in arrWildCards
If strWildcard = "*" then
dwAllItems = 1
Else
If left(strWildcard, 1) = "*" then
dwSoftLeft = 1
strWildcard = right(strWildcard, len(strWildcard) - 1)
End if
If right(strWildcard, 1) = "*" then
dwSoftRight = 1
strWildcard = left(strWildcard, len(strWildcard) - 1)
End if
End if
If strWildcard = "" then dwAllItems = 1
If dwAllItems then
TestCase = 1
Else
dwLeftOk = 0
dwRightOk = 0
dwOffSet = instr(strTestCase, strWildcard)
If dwOffSet then
If (dwSoftLeft = 0) and (dwOffSet = 1) then dwLeftOk = 1
If dwSoftLeft then dwLeftOk = 1
End if
dwRightOffSet = len(strTestCase) - dwOffset - len(strWildcard) + 1
If dwRightOffSet = 0 then dwRightOk = 1
If dwRightOffset > 0 and dwSoftRight = 1 then dwRightOk = 1
If dwLeftOk and dwRightOk then TestCase = 1
End if
Next
End Function
'**********************************************************************************
'* Test Profile Date Against the Current Date. Then Compare Against out Value
Function TestDateExclusion(dateTestCase, dateTestCurrentTime, dwTestNumDays)
TestDateExclusion = 0
dwNumDays = DateDiff("d", dateTestCase, dateTestCurrentTime)
If dwNumDays <= dwTestNumDays then TestDateExclusion = 1
If flgVerboseLog then WriteLog " Profile Age : " & dwNumDays & " Days"
End Function
'**********************************************************************************
'* Log Header
Sub WriteHeader
WriteLog "---"
WriteLog "-- Profile Deletion Script Executed: " & dateCurrentTime
WriteLog "---"
WriteLog ""
End Sub
'**********************************************************************************
'* Log Footer
Sub WriteFooter
WriteLog ""
WriteLog "---"
WriteLog "-- Profile Deletion Script Completed."
WriteLog "---"
End Sub
'**********************************************************************************
'* Write String to Log File
Sub WriteLog(strString)
If flgLogFile then objLogFile.Writeline strString
If flgWriteConsole then wscript.echo strString
End Sub
|
|
|
|
|
You can do partial conversion using tools you will find on the internet.
Try converting the remaining on your own.
If you face issues, post them here.
|
|
|
|
|
Thanks, i was trying but wasn't works fine :/, and i tried with asp2aspx but only the premium version can converts vbscript to c# :/
|
|
|
|
|
What, exactly, do you want the code to do? I ask this because .NET provides a very rich and robust framework, and it's entirely possible that there are features that it has access to that make converting this pointless.
|
|
|
|
|
i want the same funcionality in this vsb script in c#, i was trying to convert it but i'm new on c# so is dificult for me
|
|
|
|
|
I'm not going to trawl through a large block of unformatted VBS. What are you trying to accomplish? Tell us what your end goal of this code is.
|
|
|
|
|