Search:
Type: Posts; User: Code Doc
Search:
Search took 0.09 seconds.
-
I use a different approach. Define an array from 1 to N elements. Then scramble the array values using the Knuth shuffle, which is faster than greased lightning. Now simply select the elements in...
-
Read the whole text file into one string using Binary mode. Then use Instr() to find the first occurrence of the searched string. That's the fastest possible solution. After that, the code is yours...
-
Agreed. You also have to write code that checks all possible drive letters for the file. The same file name can exist on several drives. Thus, the files(s) could be anywhere on the system. It can be...
-
However, if StartPos and EndPos are both defined as Long as she did in her code, then using an integer in between the two has got to be safe in my book. In this problem, you would never have a string...
-
That's what I figured. In this thread question, I doubt that any number larger than integer would ever be encountered. Years ago we always used integer for speed whenever possible. Forcing it to long...
-
Very good, Bonnie. Just curious about one thing. I never added the ampersand in my code after the 1, 7, and 4 that you show in your code example. Why is it there in yours?
-
In addition to Doogle's idea, I used to make my own progress bar using shape controls. Each completion increment was a shape that I stacked horizontally. Initially all the shapes were invisible and...
-
How many random numbers do you want to generate and are any matched numbers allowed in the list? Please advise and read dilettante's post. This thread seems rather suspicious.
-
The code to do this, if your started from scratch, would likely be enormous, especially if the dimensions of the original matrix were left as a variable. Consider the Maths forum and look for an...
-
Not true. Build a form with a command button and a list box. Then apply this code:
Private Sub Command1_Click()
List1.Clear
Randomize
For I = 1 To 100
List1.AddItem Int(Rnd * 100) + 1...
-
You realize, of course, that you opened a thread that was five years old? Where have you been and what have you been doing for the last five years?
Please advise.
-
Back to basics:
(1) Study matrix algebra first.
(2) Then use a nested loop to sum the values.
Your problem will be solved.
-
Simplest procedure I can think of, assuming your data is always in ascending order:
Dim MyData(4) As String
MyData(0) = "01-05-10 MOXIFLOXACIN (AVELOX) 400MG-1 QD-#10-1 Refill i 041.9"
MyData(1)...
-
I posted that about five days ago when addressing a random to text file problem. Rob, you are serious that you forgot the Close statement?
Hmmmm... Well, I must admit that I forgot to memorize all...
-
Well, Max, we are right back to the most complex and fundamental problem of the entire thread--defining a word. I recall 5 years ago submitting a 20 Mb text file into two different word processors...
-
Pardon my ignorance, but I have never heard of a "loaded" or "unloaded" list box unless the list boxes are on separate forms. Is that the case here, or are you talking about the list box's...
-
Doogle's Code in Post #17 is excellent and works in almost all cases. However, OP must determine if that code properly separates one word from the next. Word count routines for text documents have...
-
Dim RecSet$(4), Min$
RecSet$(0) = "01/02/2012"
RecSet$(1) = "01/02/2013"
RecSet$(2) = "01/02/2014"
RecSet$(3) = "01/02/2015"
Min$ = RecSet$(0)
For I = 1 To 3
If RecSet$(I) < Min$ Then Min$...
-
Very good. Note that the x is not needed in the Get statement when starting the read at the beginning of the file. Subsequent Get statements (or those inside a loop) without the record number...
-
The instructor is stuck in a rut. Note that his students can't define the problem correctly and that probably means that the instructor can't either.
-
Or control them both with one invisible and the other visible. Toggle visibility back and forth as needed. Nowadays the machines run so fast that the user might not even know the difference unless...
-
Not to be the devil's advocate, but there used to be a Resize 3rd party control available for very little cost that did about everything automatically for you as the form was resized. It even changed...
-
I only have one major complaint about Type variables is that they usually wind up declared Public in a Module as I show above. Privately declaring them fails unless I'm missing something. Type was a...
-
Dilettante's suggestion is excellent. In addition, if the text box stores numbers less than 8 digits, be prepared, depending on what you want to do with these last four digits. Four may not even...
-
Here is how I would do it. Using a list box for each line, add this code to a Module to define a record Type variable:
Type MyRecType
Line1 As String * 80
Line2 As String * 80
Line3...
-
That misses many possibilities. Take a look at the list in Post #5.
-
Open the file in binary mode. Read the whole file as one buffer string. Drop the string into the textbox.
That's about a hundred times faster that anything else. Do you need code? Please advise.
...
-
An alternative to Bonnie's code:
X = 5
Do While X = 5
Exit Sub
Loop
I recall getting criticized here for using While...Wend because it was supposedly considered archaic.
-
I think you have to deal with 5-character strings rather than integers, otherwise a zero will appear somewhere. Generate a string array of all possible 5-character strings of numeric characters that...
-
I'm not even sure that OP has the problem defined correctly or knows exactly what he wants to display. The random sequence of removal would vary but the eventual removed set of either all the odds or...
-
You realize, of course, that if the computer determines at random whether the numbers being removed are going to be odd or even, it could remove nothing but odd numbers for many executions in...
-
You can even make an image look like a command button and add a Pic to the image. Build a form with a 2-image array and a label. Then add this code:
Private Sub Image1_Click(Index As Integer)
If...
-
... provided they were separated by a character? No two or more periods could be adjacent--correct?
Now that I look back, OP indicated in his list that at least these were required: v.bf.orums and...
-
Using the code in post #9, I get these using 12345 as a string:
1.2345
12.345
123.45
1234.5
1.2.345
12.3.45
123.4.5
1.2.3.45
12.3.4.5
-
Mark, I think I got it right this time, I love a challenge. This was a dandy:
Dim XX As Integer, ListPoint As Integer, OffSet As Integer
MyStr = "vbforums"
'Build an Initial List
For I = 1 To...
-
So it does. Generalizing for any string length is a challenge.
OK. I'll work on it. Seems like a simple fix once the pattern is established.
-
This works, I used a list box rather than ListView. You should be able to easily modify it for adding to a ListView instead:
Dim ListPoint As Integer, Pointer As Integer, StrLn
RootStr =...
-
Use the Knuth shuffle. Build an array of the first 52 integers and shuffle them. The Knuth shuffle is so fast that it will work well with thousands of integers. No code that I know of is faster. Do...
-
That's what I did with the code that I offered. To my knowledge, my code works and produces unbiased random selections.
-
Try building a form with a command button and a list box. Then apply this code:
Dim Nums() As Integer, Temp As Integer
Dim RangeLimit As Integer, SwapValue As Integer
Const PoolSize = 80,...
|
Click Here to Expand Forum to Full Width
|