Search:
Type: Posts; User: Logophobic
Search:
Search took 0.25 seconds.
-
Damper = -0.1
Direction = 1
Running = 0
Ticks = 0
Do
Ticks += Direction
Running = Damper * (Ticks * (Ticks + 1)) / 2
If DoReverse Then Direction *= -1
Loop
-
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 /...
-
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...
-
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)
-
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 >>...
-
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)...
-
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...
-
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,...
-
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.
-
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...
-
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()...
-
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...
-
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...
-
@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...
-
@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...
-
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...
-
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,...
-
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...
-
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'...
-
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...
-
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...
-
You need to set the form's KeyPreview property to True.
-
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,...
-
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) *...
-
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...
-
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...
-
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
...
-
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...
-
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...
-
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 ...
-
You are swapping rows with columns: (2, 1) in the first post is column 2, row 1 which my formula correctly translates to 57.
-
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 . . ....
-
Touche, and modified accordingly.
-
I gave the solution in post #3, and I believe this thread should be resolved.
-
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...
-
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...
-
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...
-
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...
-
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,...
-
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,...
|
Click Here to Expand Forum to Full Width
|