Re: String Array Insert
Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance
Of course, if you want to get creative, you'd be surprised how fast Split 7
Join are. Have a play with the following:
Private Sub Form_Load()
Dim s() As String
' Create a dummy array and show the contents
s = Split("a,b,c", ",")
Debug.Print s(0); " "; s(1); " "; s(2)
' We want to insert an element "bc" in between "b" and "c"
' Mark the insertion point and then re-generate the array
s(2) = Chr$(0) & s(2)
s = Split(Replace$(Join(s, ","), Chr$(0), "bc,"), ",")
' Now show the new result
Debug.Print s(0); " "; s(1); " "; s(2); " "; s(3)
End Sub
Tony Proctor
"Lorin" <Lorin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:473F0FC9-6DD3-4F65-93F0-7D528F084FCD@xxxxxxxxxxxxxxxx
Looking for a snippet to move string elements down in an array of strings
after additional empty elements have been added to the array e.g. redim
preserve x(ubound(x)+1).
i.e. need to quickly insert using copymemory.
.
Relevant Pages
- RE: Make all variable values in a Array equal to 0
... Dim var1 As Single ... Private Sub btnApply_Click ... just figured using an Array would reset the variables. ... Lether Seats (CheckBox1 and var1) ... (microsoft.public.excel.programming) - Re: Giving mouse movement lag
... Dim iXAs Integer ... Private Sub Form1_Click(ByVal sender As Object, ... The idea is, Form1_MouseMove adds the current mouse coords to an array, and also the current time to a secondary array. ... (microsoft.public.dotnet.languages.vb) - Re: Giving mouse movement lag
... Your REDIM is wiping out the values in the tables before they get processed. ... Dim iXAs Integer ... Private Sub Form1_Click(ByVal sender As Object, ... The idea is, Form1_MouseMove adds the current mouse coords to an array, and also the current time to a secondary array. ... (microsoft.public.dotnet.languages.vb) - Re: Giving mouse movement lag
... use ReDim Preserve instead. ... Dim iXAs Integer ... Private Sub Form1_Click(ByVal sender As Object, ... Form1_MouseMove adds the current mouse coords to an array ... (microsoft.public.dotnet.languages.vb) - Re: Need Help deleting record from text file
... I'm guessing that you'll have no problems getting the filenames from the folder into a String array, so here's some code to show you how to sort such an array and how to search it for a specific item. ... Private Sub ShellSortAs String, ... As Long, ByVal Ub As Long, ByVal cmp As Integer) ... (microsoft.public.vb.general.discussion) |
|