VB Problem Reading a random file, a record is displayed, how to display the next record?

Updated on technology 2024-05-02
14 answers
  1. Anonymous users2024-02-08

    dim x as long 'New.

    get #1, ,r2 'Read the record of R2 from the first point in channel 1; get 1, 2, r2 read the 2nd record of r2 from inside channel 1.

    if instr(1, ,s1) >0 then 'Start the search from the first character, and check whether there is a character in the record R2 is S1

    x=x+1 'New.

    if x=1 then 'New.

    true==

    else 'New.

    Here's the second record.

    exit do

    end if 'New.

    end if

    loop

  2. Anonymous users2024-02-07

    Add static index as long to the definition, assign the initial value to 1, and then index=seek(1), change seek to seek

    #1,index

  3. Anonymous users2024-02-06

    The seek function returns a long, specifying the current read and write location in the file opened by the open statement.

    dim myrecord as record 'Declaring variables.

    open "testfile" for random as #1 len = len(myrecord)

    do while not eof(1) 'Cycle to the end of the file.

    get #1, ,myrecord 'Read in the next record.

    seek(1) 'The record number is displayed in the immediate window.

    loopclose #1 'Close the file.

  4. Anonymous users2024-02-05

    Check the file write statement or file content, which may be an integer multiple of the record length when the actual file size is not equal to the record.

  5. Anonymous users2024-02-04

    You add 1, of course, to a decimal. 、

  6. Anonymous users2024-02-03

    Generally starts with 1.

    dim const position as integer=2dim myrandomfile as string*30open for random acess read as #1 len=len(myrandomfile)

    get 1,position,myrandomfile,myrandomfile after the string variables myrandomfile is stored in the myrandomfile.

  7. Anonymous users2024-02-02

    The lookup generally looks like this.

    Define a dynamic array.

    First, get the total number of records according to the file size and record size, and then redim the dynamic array just now, and then use the for statement to query in the dynamic data, instead of operating on the file, which is too troublesome to directly manipulate the file.

    If you are working with large amounts of data, we recommend that you use a database system instead of a file system.

  8. Anonymous users2024-02-01

    If it's just for display, it's recommended to use tags. This one is a little "cheaper".

    If you need to make progress on the display, consider using a text box.

    It is not recommended to print directly onto the form, as the default position starts in the top left corner. In order to look good, you have to carefully set the vertical and horizontal cursors, which are not as direct as the above two.

  9. Anonymous users2024-01-31

    Labels or text boxes are fine.

  10. Anonymous users2024-01-30

    Is it that the record number that was found last time was deleted when it was deleted, but it was not updated when it was searched, resulting in confusion of the record number?

  11. Anonymous users2024-01-29

    The record number that was last found was deleted when it was deleted, but it was not updated when it was searched, resulting in confusion of the record number!

  12. Anonymous users2024-01-28

    1 all get 1, ,c

    To change to get 1, i, c

    Also, if a = 0 then

    1end if

    To change: if a = 0 then

    1close #

    exit sub

    end if

  13. Anonymous users2024-01-27

    int(rnd()*This is a vb statement, what's the use of you putting it in double quotes and sending it to the database server? It is necessary to distinguish the difference between VB statements and SQL statements

    dim i as integer

    i= int(rnd()*

    select * from Table 1 where id=" & i

  14. Anonymous users2024-01-26

    It's just that you forget to define which variable, it's easy to find where the error message is.

Related questions
8 answers2024-05-02

Let's give you a method.,This method is set up.,You can change it to read.,If you can read the configuration, it's no problem, right? >>>More

7 answers2024-05-02

It refers to the path where the current program is located, if the program is not compiled when it is executed, that is, when the program is run in the environment of VB, its current path is in the installation directory of VB, and yours" "There is no need to add a space before it. >>>More

7 answers2024-05-02

The reading is correct, but the display of MATLAB only shows four decimal places, you can see the exact value by copying the data read into the workspace in MATLAB into XLS.

6 answers2024-05-02

I don't understand how to use recursion in your program**, if you just don't let the string with 4 be generated, use a condition. >>>More

7 answers2024-05-02

Check if the file exists.