Search:

Type: Posts; User: Logophobic

Page 1 of 13 1 2 3 4

Search: Search took 0.20 seconds.

  1. Re: Predicting an incemental/incemental number.

    Damper = -0.1
    Direction = 1
    Running = 0
    Ticks = 0
    Do
    Ticks += Direction
    Running = Damper * (Ticks * (Ticks + 1)) / 2
    If DoReverse Then Direction *= -1
    Loop
  2. Replies
    5
    Views
    2,429

    Re: [RESOLVED] Invert/Reverse Formula

    That seems like a reasonable excuse...

    CR = .357 : S = 128 : D = CR * S
    ADJ = S - (D - Sqr(D * D / 2))
    ADJ = S - (D - D / Sqr(2))
    ADJ = S - D * (1 - 1 / Sqr(2))
    ADJ = S - CR * S * (1 - 1 /...
  3. Re: How to efficiently divide a string array into several arrays under certain condit

    Simplest solution: Avoid the string concatenation by simply Printing each line to its new file.

    Best solution: Use Instr to find each line break, then use Mid to get each chunk from the source...
  4. Re: VB6 error: "argument not optional" for Inp

    Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer
    Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
  5. Re: Reading Bits & figure out equation... [Time Signature] ?

    You have your bits backward.

    'Time Signature (bits 7..3 = numerator, bits 2..0 = log2 of denominator)
    bit 7
    | bit 0
    | |
    0001101000000000 '3/4 Time Signature -- 00011 = 3, 010 = 2 >>...
  6. Replies
    13
    Views
    6,492

    Re: Converting 2 bytes to an integer in VB6

    You need to work with the sign bit separately:


    i = (b1 And &H80) * &HFF00 Or (b1 And &H7F) * &H100 Or b0

    ' or if you prefer decimal values and addition
    i = (b1 And 128) * -256 + (b1 And 127)...
  7. Replies
    6
    Views
    1,626

    Re: Send Null to CreateEvent

    VB Boolean variables are 16-bit integers. The API function expects 32-bit integer, so you need to use Long.

    If you declare lpEventAttributes As Any, you should be able to pass either UDT or ByVal...
  8. Re: [RESOLVED] Sending a Null argument to function

    I gave two examples: Test1 checks for an undimensioned array (null pointer) and Test2 checks for invalid array bounds.

    I think this is moot, though, as jms' other threads suggest that his code,...
  9. Replies
    17
    Views
    1,642

    Re: Can VB function return a UDT (structure)

    Three arrays of 1025 Long (that's 0 to 1024) require 12,372 bytes (12,300 bytes for the data, plus 24 bytes for each array). Still, that's a far cry from 32K.
  10. Replies
    17
    Views
    1,642

    Re: Can VB function return a UDT (structure)

    It will take extra work to code Property Get/Let routines, but using a class instead of a UDT may resolve this issue.

    I would like to point out that you should probably be using Long instead of...
  11. Re: [RESOLVED] Sending a Null argument to function

    There are two options that don't use an optional variant:

    1) Pass an uninitialized dynamic string array.
    2) Pass a string array returned from Split("").



    Private Sub Form_Load()
    Dim s()...
  12. Replies
    11
    Views
    4,066

    Re: Arithmetic and nested loops

    Using Option Explicit, VB would have alerted you to that error the first time you tried to run the code.

    Also, instead of ReDimming the arrays inside the loop, populate them prior to your main...
  13. Re: How do I make a constant string array

    Since you will have full control over how the string is actually used, you could define it however you like. It probably doesn't need to be an array, and certainly doesn't need to be a constant. Just...
  14. Replies
    5
    Views
    2,241

    Re: How do I find time differences with API?

    @Lord Orwell: GetTickCount returns Long


    Easy fix for that situation:


    A = &H7FFFFFF0 ' 2147483632
    B = &H8000000F ' 2147483663 (unsigned)
    If B < A Then ' A is positive, B is negative...
  15. Re: Reading a text file, as Binary, Line by Line ?

    @George: That is needlessly overcomplicated.

    Splitting the complete text on vbCrLf is the easiest way to get all lines of a text file.


    Dim strLines() As String, ff As Integer, i As Long

    ff...
  16. Re: Form issues: Clicking private message window brings chat window to front also

    So you have multiple instances of your program running, each having its main client form and multiple IM forms? In that case, what you are experiencing is normal behavior. Clicking on any form in...
  17. Re: How to detect whether active Windows application (having focus) is a 32Bit or 64B

    This question has been asked before. Link to thread.
    Here is the declaration for IsWow64Process API function.

    Private Declare Function IsWow64Process Lib "kernel32.dll" (ByVal hProcess As Long,...
  18. Replies
    3
    Views
    633

    Re: Help with code for Calculation Program

    Yes, that is simple enough:

    K2 = IIf(B2 > 20 * B10, 20, IIf(B2 > 19 * B10, 19, 0))

    An equivalent comparison would be:

    K2 = IIf(B2 / B10 > 20, 20, IIf(B2 / B10 > 19, 19, 0))

    Using a block...
  19. Re: [RESOLVED] Moving Control with Mouse - Exceeds right limit

    After posting that, I realized exactly what you were doing and decided to create the whole thing from the ground up using a picturebox, an image and two labels. It was only about 20 or 30 minutes'...
  20. Re: Moving Control with Mouse - Exceeds right limit

    This is how it is done.


    Option Explicit

    Private DoDrag As Boolean
    Private DragX As Single ', DragY As Single
    Private MinLeft As Single, MaxLeft As Single
    'Private MinTop As Single, MaxTop...
  21. Re: MouseDown + MouseMove Single Event

    Code example for that approach:


    Option Explicit

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim pic As PictureBox, picX As Single, picY As...
  22. Replies
    3
    Views
    713

    Re: Keyboard shortcuts not working?

    You need to set the form's KeyPreview property to True.
  23. Replies
    5
    Views
    1,019

    Re: string vs byte array

    Dim btData() As Byte, strData As String

    strData = "abc"

    ' This assigns Unicode string to byte array (97, 0, 98, 0, 99, 0)
    btData = strData

    ' This assigns ANSI string to byte array (97, 98,...
  24. Replies
    5
    Views
    957

    Re: No digits after comma

    You should not be using the Text property of a textbox to store the result of any calculation. Try this instead:


    Private Sub cmdbereken_Click()
    sngbruto = Val(txtaantal.Text) *...
  25. Replies
    17
    Views
    2,462

    Re: Polymorphism in VB6

    As shown in post #7, you can use a second argument to specify which format you want. Or you could choose the format based on the value passed to the function, which would provide exactly the...
  26. Replies
    26
    Views
    4,268

    Re: From Excel To Listview

    I must have assumed that the first column would not contain a zero value. Easy to fix:


    For Row = 1 To .ListItems.Count
    MinVal = 0

    For Col = FirstCol To...
  27. Replies
    26
    Views
    4,268

    Re: From Excel To Listview

    You're minv variable is persistent in the loop, so you are comparing against lowest value for all previous rows.

    My comments on your code:


    Private Sub Command1_Click()
    Dim minv As Double
    ...
  28. Replies
    3
    Views
    642

    Re: Help to find the 'correct' XY value

    Screen.Width and Screen.Height are given in twips, so you need to convert your (X, Y) pixel coordinates to twips in order to calculate the normalized absolute coordinates.

    Fair warning: if click...
  29. Replies
    21
    Views
    1,671

    Re: (RESOLVED) - button captions - please help

    I just realized that we are reinventing the wheel here.



    Private Sub Command1_Click(Index As Integer)
    Dim NewCaption As String

    NewCaption = InputBox("Enter new caption")
    If...
  30. Re: Convert row, col to single square number

    Yes, he did say Row/Col, but the numbers clearly show (Col, Row) indexing.

    The top row (i.e. row 8) is 1,8 2,8 3,8 ...
  31. Re: Convert row, col to single square number

    You are swapping rows with columns: (2, 1) in the first post is column 2, row 1 which my formula correctly translates to 57.
  32. Re: Convert row, col to single square number

    That is correct. (1, 1) is bottom left in the 2D array, and (56) is the corresponding element of the 1D array.


    1,8 . . . 8,8
    . .
    . .
    . .
    1,1 . . . 8,1

    00 . . ....
  33. Replies
    21
    Views
    1,671

    Re: (RESOLVED) - button captions - please help

    Touche, and modified accordingly.
  34. Re: Convert row, col to single square number

    I gave the solution in post #3, and I believe this thread should be resolved.
  35. Replies
    21
    Views
    1,671

    Re: (RESOLVED) - button captions - please help

    Edit: Modified in response to techgnome's reply. See quote in following post for original comment and code.

    Form1 Code:


    Private Sub Command1_Click(Index As Integer)
    Form2.Show vbModal, Me...
  36. Replies
    21
    Views
    2,546

    Re: getting last Saturday of the month Alarm

    Another issue with DM's code is that it returns the Saturday before the last day of the month, which is the wrong Saturday when the last day of the month is Saturday.

    Corrected code, returns the...
  37. Re: Convert row, col to single square number

    NW, there' not much to it: he has two arrays, a two-dimensional array (1 to 8, 1 to 8) and a one-dimensional array (0 to 63). Both are representations of a chessboard, and he simply needs to get an...
  38. Replies
    26
    Views
    4,268

    Re: From Excel To Listview

    I would be more concerned about having too many columns than too many rows. Judging from your screenshot, you would only be able to view the information for 3 or 4 suppliers without scrolling. This...
  39. Re: [RESOLVED] What's wrong with this For...Next

    For what it's worth, there is absolutely nothing wrong with the loop as posted. It cannot behave as you have described. The only thing I can imagine is that you had a typo in your code: Step -i,...
  40. Re: Convert row, col to single square number

    Gaah!! Why would you suggest anything with strings?

    If you're going to store pre-calculated values in arrays, at least stick with numeric types.
    I wouldn't bother wrapping them in a function,...
Results 1 to 40 of 500
Page 1 of 13 1 2 3 4



Click Here to Expand Forum to Full Width