EmersonH.Com

Transforming Knowledge into Power

  • spacer
  • spacer
  • spacer
Welcome

Only Numeric Textboxes

Tuesday, 27 September 2011 21:03
spacer spacer spacer

Public Function OnlyNumericKeys(KeyAscii As Integer, TextBox As control) As Integer

Select Case KeyAscii
Case 8, 48 To 57, 46 And InStr(TextBox, ".") = 0
Case 45 And InStr(TextBox, "-") = 0

If TextBox.SelStart > 0 Then
KeyAscii = 0
End If
Case Else

KeyAscii = 0

End Select
OnlyNumericKeys = KeyAscii

End Function

Last Updated on Tuesday, 27 September 2011 23:11
 

Word Wrap

Tuesday, 27 September 2011 20:58
spacer spacer spacer

Function WWrap(StrDummy As String, StrSize As Integer) As String

If Len(Trim(StrDummy)) < StrSize Then
WWrap = StrDummy
Exit Function
End If

Dim StrLine1 As String
Dim LoopI As Integer
Dim IntJ As Integer
LoopI = 1
StrLine1 = Mid(StrDummy, LoopI, StrSize)
WWrap = ""
While Trim(StrLine1) <> ""
If (Mid(StrDummy, (LoopI - 1) * Len(StrLine1) + 1, 1) <> " ") Then
IntJ = InStrRev(StrLine1, " ")
If IntJ <> 0 Then
StrDummy = Mid(StrDummy, 1, (LoopI - 1) * StrSize + IntJ - 1) + String(StrSize - IntJ + 1, " ") + Mid(StrDummy, (LoopI - 1) * StrSize + IntJ + 1)
End If
End If
LoopI = LoopI + 1
StrLine1 = Padr(Mid(StrDummy, (LoopI - 1) * StrSize + 1, StrSize), StrSize)
Wend
WWrap = StrDummy
End Function

 

Posting Articles

Friday, 23 September 2011 22:16
spacer spacer spacer

Greetings,

 

I will start tweaking and posting more articles very soon.  I would like to encourage anyone who would like share some knowledge to register and post their own articles.

 

Have a wonderful day!

Emerson

Last Updated on Friday, 23 September 2011 22:52
 

InStr

Tuesday, 27 September 2011 14:43
spacer spacer spacer

InStr returns the first occurrence of a string inside another string.

InStr([start,] string1, string2 [, compare])
start
Optional. Character position where the search starts. If omitted, the search starts at the start of string1, position 1. Valid input values: 1 to Len(string1)
string1
The string to search in. Can be Null.
string2
The string to find. This is the text you want to find inside string1. It is usually shorter than string1. Can be Null.
compare
Optional. Specifies the type of string comparison.
  • vbBinaryCompare (0) performs a fast binary comparison where each character matches only itself. This is the default.
  • vbTextCompare (1) performs a text comparison.
  • vbDatabaseCompare (2). For Microsoft Access (Windows only), performs a comparison based on information contained in your database.
  • If you omit compare, InStr will use the setting of the Option Compare statement.
Binary comparison is the safest option. Text comparison rules vary by the system locale. In text comparison, what matches on one computer may not match on another.

Return value

InStr returns one of the following values:
  • Null if either string1 or string2 is Null.
  • start if string2 is empty.
  • Character position of the first occurrence of string2 in string1.
  • Zero if string2 was not found in string1.
Special cases:
  • InStr(string1, "") returns 1 if string1 is not empty.
  • InStr("", "") returns 0.
  • If start exceeds the length of string1, there is never a match and InStr returns 0.
 

Main Menu

  • Home
  • AutoIt
  • C#
  • Java and J2EE
  • T-Sql
  • VB 6
  • VB.Net 2008
  • XML
  • Links
  • Old Links

Resources

  • Administrator

Login Form

  • Forgot your password?
  • Forgot your username?
  • Create an account


Latest News

  • Only Numeric Textboxes
  • Word Wrap
  • InStr
  • datediff busniess days
  • DateDiff of weekdays

Popular

  • Set a Combo Box's Maximum Text Length
  • Internet
  • Record Count
  • Date Difference
  • How Do I Run A CMD Command In A Vb Application?
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.