Search:

Type: Posts; User: Code Doc

Page 1 of 13 1 2 3 4

Search: Search took 0.09 seconds.

  1. Thread: Randomizing

    by Code Doc
    Replies
    14
    Views
    1,722

    Re: Randomizing

    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...
  2. Re: fast find strig in txt file with approx 700.000!!!!!!

    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...
  3. Re: Classic VB - How can I check if a file exists?

    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...
  4. Replies
    13
    Views
    8,543

    Re: help extract this string

    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...
  5. Replies
    13
    Views
    8,543

    Re: help extract this 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...
  6. Replies
    13
    Views
    8,543

    Re: help extract this string

    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?
  7. Replies
    9
    Views
    1,612

    Re: How to code progressbar

    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...
  8. Replies
    5
    Views
    2,461

    Re: Random Numbers from 0 to &HFFFFFFFF

    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.
  9. Replies
    7
    Views
    9,362

    Re: How to find Matrix Inverse in VB6?

    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...
  10. Replies
    3
    Views
    778

    Re: Random Number

    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...
  11. Replies
    13
    Views
    33,137

    Re: How to Save listbox items to text file

    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.
  12. Replies
    15
    Views
    1,484

    Re: addition with arrays ????

    Back to basics:

    (1) Study matrix algebra first.
    (2) Then use a nested loop to sum the values.

    Your problem will be solved.
  13. Replies
    9
    Views
    1,163

    Re: Arranging printed lines by date

    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)...
  14. Replies
    12
    Views
    16,844

    Re: Close All Open Files [Resolved]

    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...
  15. Re: [RESOLVED] Replace random words in a textbox with underline _________

    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...
  16. Replies
    11
    Views
    1,333

    Re: Listbox Array problem

    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...
  17. Re: Replace random words in a textbox with underline _________

    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...
  18. Replies
    7
    Views
    1,672

    Re: min value in recordset

    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$...
  19. Replies
    17
    Views
    2,429

    Re: Random Access Records

    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...
  20. Replies
    4
    Views
    942

    Re: arrange string

    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.
  21. Replies
    5
    Views
    1,819

    Re: Listbox Multiselect Property

    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...
  22. Replies
    7
    Views
    16,519

    Re: Resize Form & Controls For Screen Size - VB6

    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...
  23. Replies
    17
    Views
    2,429

    Re: Random Access Records

    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...
  24. Re: How to get last 4 digits from a textbox to a label?

    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...
  25. Replies
    17
    Views
    2,429

    Re: Random Access Records

    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...
  26. Replies
    11
    Views
    1,522

    Re: How to arrange strings like that?

    That misses many possibilities. Take a look at the list in Post #5.
  27. Re: Read Input file directly into listbox

    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.
    ...
  28. Re: Check the value of a Variable then take some action

    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.
  29. Replies
    50
    Views
    3,932

    Re: Random NUmbers - How To

    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...
  30. Re: Have a listbox randomly pick to remove either the odd numbers or the even numbers

    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...
  31. Re: Have a listbox randomly pick to remove either the odd numbers or the even numbers

    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...
  32. Re: how to change the shape of command buttons in vb 6.0

    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...
  33. Replies
    14
    Views
    2,498

    Re: [HELP] String Manipulation

    ... 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...
  34. Replies
    14
    Views
    2,498

    Re: [HELP] String Manipulation

    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
  35. Replies
    14
    Views
    2,498

    Re: [HELP] String Manipulation

    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...
  36. Replies
    14
    Views
    2,498

    Re: [HELP] String Manipulation

    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.
  37. Replies
    14
    Views
    2,498

    Re: [HELP] String Manipulation

    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 =...
  38. Re: List of Random Unique Numbers from 1 to 52?

    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...
  39. Re: randomize 1 to 80 numbers better than the Randomize function vb6

    That's what I did with the code that I offered. To my knowledge, my code works and produces unbiased random selections.
  40. Re: randomize 1 to 80 numbers better than the Randomize function vb6

    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,...
Results 1 to 40 of 500
Page 1 of 13 1 2 3 4



Click Here to Expand Forum to Full Width