2 Questions

Brokenhope

New member
Joined
Sep 24, 2005
Messages
3
Programming Experience
3-5
Please answer one or both of these questions.

1. How can I redefine an array (heres what I mean).

'Global Variable
Public strHighlights() As String

'Inside some function later on in the code
strArray2() = Array("Blah", "Blah", "blah3322")
strHighlights = strArray2

That isnt the actual code setup, but its what I need to do, I have a global variable, which is an array of highlights, and the array is changed once in awhile, and I need to get that updated. What its updated as is an array, so array1 = array2, and the 2 most likely will never be the same size.


2. My syntax highlighter for the RichTextBox control, it is 100% working, it highlights correctly, always works on the right word, not really a noticable lag, except on really long lines that a lot of words are highlighted. My problem is that you can visibly see for a split second the text selected so selectedtext.color will work correctly, and I would like that proccess to be visible, is there any way I can kinda duplicate the richtextbox, do it on the duplicated one, then apply that to the original? or something similar?
 
1. to re-dimension an array use the ReDim Preserver statments

the ReDim keyword does exactly that, it re-sizes the array to whatever size you need
the Preserve keyword means that when an array is resized the current data in the array is still there after the resize occurs, but keep in mind that if an array is completely filled and you make it smaller then the data in the "lost" elements are gone

also for this type of use i'd actually recamend using a collection instead of an array as collection's make it easy to add unknown amounts of items and removing items is just as easy as adding them, plus collections (unlike arrays) maintain themselves when things are added and removed

2. i dont know :(
 
Back
Top