The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 28/10/2014
- Original post
''' | |
' Note that Split always returns a 0-indexed array | |
''' | |
Option Explicit | |
Function flip_name(comma_sep_name As String) | |
Dim name_parts() As String | |
name_parts = Split(comma_sep_name, ",") | |
Private Sub theGrid_DataBound(ByVal sender as Object, ByVal e as System.EventArgs) Handles theGrid.DataBound | |
' Create a GridView object and cast the GridView object we're working on to it | |
Dim gv As ASPxGridView = TryCast(sender, ASPxGridView) | |
' Loop through the visible columns (as they are set in the ASP or somewhere else in your code) | |
For i As Integer = 0 To gv.VisibleColumns.Count | |
' Match the type of the current column to the GridViewCommandColumn type and | |
' then hide the column and break out of the loop | |
If TypeOf (gv.VisibleColumns(i)) Is GridViewCommandColumn Then |
++++++++++ set loop counter to ten | |
[ | |
>>>>+++ increase 5th cell by 3 | |
<<<<- decrease loop counter | |
] | |
>>>>++ increase 5th cell by 2 to make the 'Space' ASCII code | |
<<<<++++++++++ reuse 1st cell as loop counter increase to ten | |
[ | |
>+++++ increase 2nd cell by 5 | |
>+++++ increase 3rd cell by 5 |
Sub SplitColumn( _ | |
ByVal LastRow As Long, _ | |
ByVal DataCol As String, _ | |
ByVal FirstPartCol As String, _ | |
ByVal SecondPartCol As String, _ | |
ByVal DelimCharacter As String _ | |
) | |
Dim data_col As String, col_one As String, col_two As String, delimiter As String | |
data_col = DataCol |
Sub FindValue() | |
Dim ws As Excel.Worksheet | |
Set ws = ActiveSheet | |
Dim i As Integer, lastRow As Integer | |
lastRow = 328 | |
Dim fromCol As String, toCol As String, field As String, delim As String | |
fromCol = "C" |
' Make sure you've referenced the Microsoft Scripting Runtime library in your project | |
' In the VBA Editor: Tools > References... | |
Function TextStreamFactory(ByVal NewFileName As String) As Scripting.TextStream | |
Dim fs As New Scripting.FileSystemObject | |
Dim ts As Scripting.TextStream | |
Set ts = fs.CreateTextFile(NewFileName) | |
Set TextStreamFactory = ts | |
End Function |
' Needs error checking and to handle more than just strings | |
' Usage: | |
' StringFormat("My {2} dogs are {0}, {3}, and {1}.", "Dumbo", "Tim", "3", "Marsha") | |
Function StringFormat(ByVal ParseTemplate As String, ByVal Arg As String, ParamArray Args() As Variant) As String | |
Dim lastItemIndex As Integer, combinedArgs() As Variant | |
' Combine the passed in arguments | |
If Not UBound(Args) < LBound(Args) Then | |
ReDim combinedArgs(0 To UBound(Args) + 1) |
This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.
I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.
GRANT EXECUTE ON SCHEMA :: <schema here> TO <user/role here>; |